JSONObject which start with {}
JSONArray which start with []
In your case you have a JSONObject which has an JSONArray.
let me give you an example.
public void createJson() throws JSONException {
// Create main JSON object
JSONObject jsonObject = new JSONObject();
//Create an JSON ARRAY which will have a key "contact_approve" later on
JSONArray jsonArray = new JSONArray();
Integer contacts[] = {1,2,3,4,5};
for (int i = 0; i < contacts.length ; i++) {
JSONObject contactID = new JSONObject();
jsonArray.put(contactID.put("contact_id", i));
}
jsonObject.put("contact_approve", jsonArray);
String json = jsonObject.toString();
Log.d("JSON", json);
}
Incase if you need to Parse the JSON response, have a look at Moshi and GSON libraries which make your day better. These libraries can Parse JAVA classes in to JSON.
I use [https://codebeautify.org/jsonviewer] to view or minify the json.
Good luck.