There is a certain ArrayList filled with data, how do I transfer this array to the server?

  • one
    envelope in json JSONArray ar=new JSONArray(myArrayList); String json= ar.toString() JSONArray ar=new JSONArray(myArrayList); String json= ar.toString() and pull? - Alexey Shimansky

1 answer 1

Use JSONObject .

Example:

 JSONObject jsonObject = new JSONObject(); JSONArray jsonArray = new JSONArray(); try { jsonObject.put("jsonArray",jsonArray); } catch (JSONException e) { e.printStackTrace(); }