{
"terms": [{
"offset": 0,
"value": "Nerkundram"
}, {
"offset": 12,
"value": "Chennai"
}, {
"offset": 21,
"value": "Tamil Nadu"
}, {
"offset": 33,
"value": "India"
}]
}
-
study this example journaldev.com/2321/gson-example-tutorial-parse-jsonxbadal– xbadal2017-03-23 10:42:20 +00:00Commented Mar 23, 2017 at 10:42
-
#Chandana_Raj This type of question already asked on here .Before asking question search on GoogleIntelliJ Amiya– IntelliJ Amiya2017-03-23 10:42:31 +00:00Commented Mar 23, 2017 at 10:42
-
stackoverflow.com/questions/6118708/…xbadal– xbadal2017-03-23 10:43:49 +00:00Commented Mar 23, 2017 at 10:43
-
oops sorry @IntelliJ AmiyaChandana_Raj– Chandana_Raj2017-06-07 11:01:33 +00:00Commented Jun 7, 2017 at 11:01
-
@Chandana_Raj for what ?IntelliJ Amiya– IntelliJ Amiya2017-06-07 11:13:25 +00:00Commented Jun 7, 2017 at 11:13
|
Show 1 more comment
1 Answer
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();
}
2 Comments
Chandana_Raj
thanks for your answer @rafsanahmad007
rafsanahmad007
if the answer helps mark it as correct by clicking the tick sign on left of the answer...thankx.@Chandana_Raj