{
"terms": [{
"offset": 0,
"value": "Nerkundram"
}, {
"offset": 12,
"value": "Chennai"
}, {
"offset": 21,
"value": "Tamil Nadu"
}, {
"offset": 33,
"value": "India"
}]
}
Asked
Active
Viewed 1,032 times
2

rafsanahmad007
- 23,683
- 6
- 47
- 62

Chandana_Raj
- 116
- 2
- 13
-
study this example http://www.journaldev.com/2321/gson-example-tutorial-parse-json – xbadal Mar 23 '17 at 10:42
-
#Chandana_Raj This type of question already asked on here .Before asking question search on Google – IntelliJ Amiya Mar 23 '17 at 10:42
-
http://stackoverflow.com/questions/6118708/determine-whether-json-is-a-jsonobject-or-jsonarray?rq=1 – xbadal Mar 23 '17 at 10:43
-
oops sorry @IntelliJ Amiya – Chandana_Raj Jun 07 '17 at 11:01
-
@Chandana_Raj for what ? – IntelliJ Amiya Jun 07 '17 at 11:13
-
for asking question without searching it on google – Chandana_Raj Jun 07 '17 at 11:23
1 Answers
2
Use this:
try{
JSONObject json = new JSONObject(jsonString);
JSONArray jsonArray = json.getJSONArray("terms");
for(int i=0;i<jsonArray.length();i++){
JSONObject object = jsonArray.getJSONObject(i);
String offset = object.getString("offset");
String value = object.getString("value");
//rest of the strings..
}
}
catch (JSONException e){
e.printStackTrace();
}

rafsanahmad007
- 23,683
- 6
- 47
- 62
-
-
if the answer helps mark it as correct by clicking the tick sign on left of the answer...thankx.@Chandana_Raj – rafsanahmad007 Jun 01 '17 at 05:24