[arrays] json and empty array

I have the following json :

{
   "users":
    [{
       "user": 
        {
        "user_id"  :"a11uhk22hsd3jbskj",
        "username" :"tom",
        "location" : null
        }
    }]
}

I get this json in response to a request to an api. Looking at the doc for this api, location is supposed to be an array (containing geodata, latitude, longitude address etc).
Now the question is : there's an error in the json? I mean, location doesn't seems,to me, to be an array, or is possible to represent a null array in that way? and if yes what is the difference between :

"location" : null 
"location" : []

Thanks in advance

This question is related to arrays json

The answer is


The first version is a null object while the second is an Array object with zero elements.

Null may mean here for example that no location is available for that user, no location has been requested or that some restrictions apply. Hard to tell with no reference to the API.


"location" : null // this is not really an array it's a null object
"location" : []   // this is an empty array

It looks like this API returns null when there is no location defined - instead of returning an empty array, not too unusual really - but they should tell you if they're going to do this.