I have this format of code. Can anyone help me how can I read the array? I need to read contacts array.
 {
  "success": true,
  "contacts": [
  {
  "username": "ceema",
  "profile": {
    "name": "Ceema S",
    "email": "ceemas@gmail.com",
    "address": "No 143, gangaeyam, Maikkad P O, Kerala",
    "phone": {
      "mobile": "3333",
      "home": "2222",
      "office": "6666"
    }
  }
},
{
  "username": "hari",
  "profile": {
    "name": "Harikrishnan V S",
    "email": "harikriii@gmail.com",
    "address": "No 143, harihome, Maikkad P O, Kerala",
    "phone": {
      "mobile": "3333",
      "home": "2222",
      "office": "6666"
    }
  }
},
{
  "username": "pranav",
  "profile": {
    "name": "Pranav Mohan",
    "email": "pranavmohan@gmail.com",
    "address": "No 143, harihome, Maikkad P O, Kerala",
    "phone": {
      "mobile": "3333",
      "home": "2222",
      "office": "6666"
    }
  }
}
]
}
I tried this :
if (jsonStr != null) {
            try {
                JSONObject jsonObj = new JSONObject(jsonStr);
                // Getting JSON Array node
                contacts = jsonObj.getJSONArray(TAG_CONTACTS);
                // looping through All Contacts
                for (int i = 0; i < contacts.length(); i++) {
                    JSONObject c = contacts.getJSONObject(i);
                    //String id = c.getString(TAG_NAME);
                    String name = c.getString(TAG_NAME);
                    String email = c.getString(TAG_EMAIL);
                    String address = c.getString(TAG_ADDRESS);
                    //String gender = c.getString(TAG_GENDER);
                    // Phone node is JSON Object
                    JSONObject phone = c.getJSONObject(TAG_PHONE);
                    String mobile = phone.getString(TAG_PHONE_MOBILE);
                    String home = phone.getString(TAG_PHONE_HOME);
                    String office = phone.getString(TAG_PHONE_OFFICE);
This jsonstr is json response from the site. I need to read the nested contacts and populate it to
 
     
     
     
    