Easiest understanding:
When syntax is {} then this is JsonObject
When syntax is [] then this is JsonArray
JSONObject:
- Contains named values (key->value pairs, tuples or whatever you want to call them)
like {ID : 1} - Order of elements is not important
a JSONObject of {id: 1, name: 'B'} is equal to {name: 'B', id: 1}.
JSONArray:
- Contains only series values
like [1, 'value'] - Order of values is important
array of [1,'value'] is not the same as ['value',1]
Additional info:
We can use the Array first approach if we intend to store a set of values with no need to identify uniquely.
[
{
"Employees":[
{
"Name":"Alan",
"Children":[
"Walker",
"Dua",
"Lipa"
]
},
{
"Name":"Ezio",
"Children":[
"Kenvey",
"Connor",
"Edward"
]
}
]
}
]