Reputation: 32321
I have got this JSON valid JSONArray
[
{
"RestaurantName": "OhrisHome",
"Locality": "Near Office"
},
{
"RestaurantName": "SwagtahtHome",
"Locality": "Near Home"
}
]
I need to identify this Array with some name
So i am trying to add a Key to this JSON Array as shown
{
"Type" : "Home"
[
{
"RestaurantName": "OhrisHome",
"Locality": "Near Office"
},
{
"RestaurantName": "SwagtahtHome",
"Locality": "Near Home"
}
]
}
Upvotes: 1
Views: 36
Reputation: 82287
In the object, they key will be the name of the array, and the values will be the array itself. Just change "ArrayName" to something more applicable.
{
"Type" : "Home",
"ArrayName" :
[
{
"RestaurantName": "OhrisHome",
"Locality": "Near Office"
},
{
"RestaurantName": "SwagtahtHome",
"Locality": "Near Home"
}
]
}
Upvotes: 1