Closed ErosOlmi closed 7 years ago
The JSON standards are only describing the data format itself, not how to use them.
There are certainly standards out there about how data should be represented in JSON form, but I don't think there is any definitive standard on it. Also I'm not familiar enough with it to name any one standard.
All I can give you is my personal opinion: If something is a collection, it should stay a collection no matter how many entries. So in case of 0 elements it should be an empty array, one or more elements should be an array with entries. Anything else is just inconsistent and making it harder both for implementing the server and the client.
But just my opinion as I said.
Thanks a lot. Your opinion is also my opinion. I will complain with who has created this export :)
I have a question about "standards"
I got crazy about a server that returns, for the same node, an array or an object depending on how many items are present. If only one item is present, it returns an object. If more items are present, it returns an array. My question is: is it correct behave?
My idea is that even if 1 item or zero items are present, it should return an array. But maybe I'm wrong
Below examples for the 2 conditions. Node changing type is "Movimento". First example is with one element, second example is with 3 elements.
Thanks in advance Eros