We can use JSONArray to parse JSON which starts with the array brackets. A collection of related items can be included in JSONArray. (Number of JSON objects can be included within JSONArray).
EG:
[
{"label":"HA0-Brent","id":"1085","table":"plot_dis"},
{"label":"HA1-Harrow","id":"1086","table":"plot_dis"},
{"label":"HA2-Harrow","id":"1087","table":"plot_dis"},
{"label":"HA3-Harrow","id":"1088","table":"plot_dis"},
{"label":"HA4-Hillingdon","id":"1089","table":"plot_dis"}
]
We can use JSONObject when dealing with JSON that begins with curly braces. A JSON object contains key/value pairs related to item.
EG: {"email":"testbawebservice@gmail.com","password":"testba123"}
JSON arrays and objects can be nested in one another.
EG:{
"code":"0",
"message":"success",
"locations":[
{"label":"HA0-Brent","id":"1085","table":"plot_dis"},
{"label":"HA1-Harrow","id":"1086","table":"plot_dis"},
{"label":"HA2-Harrow","id":"1087","table":"plot_dis"},
{"label":"HA3-Harrow","id":"1088","table":"plot_dis"},
{"label":"HA4-Hillingdon","id":"1089","table":"plot_dis"}
]}
EG:
[
{"label":"HA0-Brent","id":"1085","table":"plot_dis"},
{"label":"HA1-Harrow","id":"1086","table":"plot_dis"},
{"label":"HA2-Harrow","id":"1087","table":"plot_dis"},
{"label":"HA3-Harrow","id":"1088","table":"plot_dis"},
{"label":"HA4-Hillingdon","id":"1089","table":"plot_dis"}
]
We can use JSONObject when dealing with JSON that begins with curly braces. A JSON object contains key/value pairs related to item.
EG: {"email":"testbawebservice@gmail.com","password":"testba123"}
JSON arrays and objects can be nested in one another.
EG:{
"code":"0",
"message":"success",
"locations":[
{"label":"HA0-Brent","id":"1085","table":"plot_dis"},
{"label":"HA1-Harrow","id":"1086","table":"plot_dis"},
{"label":"HA2-Harrow","id":"1087","table":"plot_dis"},
{"label":"HA3-Harrow","id":"1088","table":"plot_dis"},
{"label":"HA4-Hillingdon","id":"1089","table":"plot_dis"}
]}
No comments:
Post a Comment