I am preparing a json object to be sent over a webservice , I am trying to put a list of String in the object, Something like this:
["24348f08-92f4-481a-9a36-ed0d533ca4f3", "24348f08-92f4-481a-9a36-ed0d533ca4f3"]
What i have done:
sendData.put("SpecializationAlert",Specialization);
sendData is a json object and Specialization is a String array, the result when i log this is:
"[\"24348f08-92f4-481a-9a36-ed0d533ca4f3\",\"24348f08-92f4-481a-9a36-ed0d533ca4f3\"]"
Specialization is put in the JSON as a toString()-ed object. You may create a JSONArray from it first and then include it in the JSONObject:
sendData.put("SpecializationAlert",new JSONArray(Arrays.asList(Specialization)));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With