JSON means JavaScript Object Notation. JSON is, however, a text format although
it has the mimetype application/json.
The acronym suggests that it defines objects.
Objects are to be taken in the JavaScript sense with the exception
that methods are not supported, at least yet. Also there are
some syntactical requirements with respect to strictness.
[
{
"name": "Aarhus",
"population": 340421,
"country": "DNK"
},
{
"name": "Fredericia",
"population": 51326,
"country": "DNK"
},
{
"name": "Kolding",
"population": 92515,
"country": "DNK"
}
]An object is a curly braces delimited, unordered, and comma-separated list of name/value pairs. There may be between 0 and many elements. The comma may be omitted after the last element. The rules are
Number,Boolean,Null,String,Object, orArray
A JSON array is a ordered, and comma separated list of values. The values must be of the types mentioned above[16].
[15] Do, however think of the host systems using the object. Names become attributes or properties. It might therefore be a good rule of thumb to follow the rules of variable names from host programming languages.
[16] It is syntactically legal to mix types in an array. It might, depending on usage, be a good rule of thumb not to. Some host programming languages do not accept it.