2
{
    "terms": [{
        "offset": 0,
        "value": "Nerkundram"
    }, {
        "offset": 12,
        "value": "Chennai"
    }, {
        "offset": 21,
        "value": "Tamil Nadu"
    }, {
        "offset": 33,
        "value": "India"
    }]
}
6

1 Answer 1

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();
}
Sign up to request clarification or add additional context in comments.

2 Comments

thanks for your answer @rafsanahmad007
if the answer helps mark it as correct by clicking the tick sign on left of the answer...thankx.@Chandana_Raj

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.