how can parsing this output
{
"durum": "tamam",
"mahalleler": [
{
"mahalle_kodu": "1",
"mahalle_ismi": "BEKTAŞ MAH."
},
{
"mahalle_kodu": "2",
"mahalle_ismi": "ÇARŞI MAH."
}]}
i try this code but return "null".
contacts = json.getJSONArray("mahalleler");
for (int i = 0; i < contacts.length(); i++) {
JSONObject c = contacts.getJSONObject(i);
String name = c.getString("mahalle_kodu");
String body = c.getString("mahalle_ismi");}
what is the problem? json output has two variable; mahalleler[] and durum. i wanna parse durum's valur and values of mahalleler array. But i couldnt do that.
for loop
makes them local to that loop. Try creatingclass variables
and assigning them value.