I am trying to get data from this JSON file like this: http://api.worldbank.org/countries/ir?format=json
If you have a look at the file by a JSON editor(like this), you will see that there are arrays and objects inside arrays. I can Only get access to the first level. But how to access to deepr levels. Here what I have done so far:
JSONArray array = json.getJSONArray("data");
JSONObject c = array.getJSONObject(0);
JSONArray array2 = array.getJSONArray(1);
JSONObject c2 = array2.getJSONObject(0);
//Storing JSON item in a Variable
String name = c2.getString(NAME);
String capitalCity = c2.getString(CAPITALCITY);
So by this lines of codes I can get the country name and the capital city.
But in the same array there is another object called region which it has two other strings, id and value . How can I access inside region and get the value?