JSON:
Stands for JavaScript Object Notation.
In JSON, we have mainly 3 types of data.
Variable – single value of any primitive type
Object – JSONObject
Array – JSONArray
In JSON, We can identify the type of data based on 2 type of braces
{ – Represents a JSONObject
[ – Represents a JSONArray
1) A JSONObject can be a collection of variables, JSONArray(s), JSONObject(s)
2) The inner JSONObject(s) also can have the same structure defined in point-1
3) A JSONArray is a collection of similar type of data. The data can be single variables or JSONObject(s)
4) Every JSON value starts with either ‘{‘ or ‘[‘. If it is started with ‘{‘, that is a JSONObject. If it is started with ‘[‘, that is a JSONArray.
JSON is a light-weight data exchange format, used for exchanging data with a server.
Ex:
{
“Last login”:145455445544,
“User”:{“Name”:”Sam”,
“Mobile”:9849008285,
“Status”:”Available”},
“Chats”:[{“Mobile”:9878978984, “chat”:[“Adsnsdm”, “shwuij”]},
{“Mobile”:9878978984, “chat”:[“Adsnsdm”, “shwuij”]}]
}
To view, JSON structure coming from server, we have so many online JSON viewers. One of those is