I have a JSON that has 4 JSON objects, my question is how to travel in such a way that with first do one thing with the second one and so on I've tried with:
JSONArray ja = new JSONArray(response);
for (int i = 0; i < ja.length(); i++) {
JSONObject row = ja.getJSONObject(i);
String pasi =row.getString("nombre");
}
But only melo goes through if it receives a JSON object, the problem is that it must receive one of 4 levels (4 arrays within a single one)
The received json is the following:
{"paises":[{"id":"68","nombre":"El Salvador","activo":"1"},{"id":"70","nombre":"Eritrea","activo":"0"}],
"procedencia":[{"id":"1","nombre":"Establecimiento"},{"id":"2","nombre":"Colvol"},{"id":"3","nombre":"Promotor Antimalaria"}],
"clave":[{"id":"2","id_departamento":"11","id_municipio":"185","correlativo":"40","clave":"11-40"}],
"departamento":[{"id":"1","nombre":"Ahuachap\u00e1n","id_pais":"68"},{"id":"2","nombre":"Santa Ana","id_pais":"68"}]}