// JSON object to hold the information, which is sent to the server
JSONObject jsonObjSend = new JSONObject();
jsonObjSend.put(\"action\", \"myAction\");
jsonObjSend
JSONObject jsonBody = new JSONObject();
jsonBody.put("action", "myAction"); //action is your string
jsonBody.put("type", "elementi");
JSONArray arr = new JSONArray();
JSONObject elementi= new JSONObject();
itemList.put("id", id);
itemList.put("name", name);
arr.put(elementi);
jsonBody.put("elementi", arr);