-6

[{"id":"1","name":"Nurullah","surname":"xxxxxx","il":"eskisehir"},{"id":"2","name":"Ozgur","surname":"yyyyyy","il":"istanbul"},{"id":"3","name":"Emre","surname":"zzzzzz","il":"ankara"}]

I showed my JSON above. I dont know that how can i parse my string in android? thank yo for answers.

  • 2
    Please Google first before posting question here. – Chintan Soni May 03 '17 at 09:04
  • 1
    What have you done till now? – AbhayBohra May 03 '17 at 09:04
  • @Denny Don't use this post as a reference please. There are historical reasons it still exists, otherwise it wouldn't be there anymore. – greenhoorn May 03 '17 at 09:06
  • i looked for it in google, but i dont understand for their json format that is different. @chintan-soni – Nurullah Çelebi May 03 '17 at 09:09
  • 1
    @greenhoorn I think you're misinterpreting the banner note, there. Though we no longer want questions asking for step-by-step instructions, guides, or tutorials, the information in the answers there is still perfectly valid, and can be used for reference. – Mike M. May 03 '17 at 09:25

1 Answers1

0

Basically '[]' this represent as JSONArray and '{}' this represent JSONObject

 try {
        JSONArray jsonArray = new JSONArray(response);
        for(int i=0; i<jsonArray.length(); i++){
            JSONObject jsonObject = jsonArray.getJSONObject(i);

            String id = jsonObject.getString("id");
            String name = jsonObject.getString("name");
            String surname = jsonObject.getString("surname");
            String il = jsonObject.getString("il");
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
Mohammad nabil
  • 1,010
  • 2
  • 12
  • 23