2016-04-18 12 views
-4

{ "Fehler" analysieren: null, "InternalError": null, "isSuccessful": true, "Message": null, "Branches": [ { " Id ": 1, "Name": "XYZ", "Years": [ { "Id": 6, "Jahr": "2015 bis 2016" } ] } ] }Wie Nested Json Array in android

+0

was verwenden Sie Volly, Retrofit ?? ..... was haben Sie ausprobiert ?? –

+0

Verwendet normalen HTTP-Client .. – Ravi

+0

die Ballade Antwort von MDDroid ist richtig .. go damit. –

Antwort

0
JSONObject mainObj = new JSONOBject("Your Response"); 
if(mainObj != null){ 
JSONArray list = mainObj.getJSONArray("Branches"); 
if(list != null){ 
    for(int i = 0; i < list.length();i++){ 
     JSONObject elem = list.getJSONObject(i); 
     if(elem != null){ 
      JSONArray prods = elem.getJSONArray("Years"); 
      if(prods != null){ 

        //Your Code here 
       } 
      } 
     } 
    } 
}