I want to convert json string to json object with it's order. My code:
String responseData = "{ \"contents\": [ { \"a\" : \"A\" , \"b\": \"B\", \"c\" : \"C\" } ] , \"maxsize\" : 5, \"startIndex\" : 1, \"status\" : \"suspended\", \"activated\" : false}"
JSONObject jsonObject = new JSONObject(responseData);
System.out.println(jsonObject.toString());
I used org.json version - 20200518 library and when I tried , I got following output:
{"startIndex":1,"contents":[{"a":"A","b":"B","c":"C"}],"maxsize":5,"status":"suspended","activated":false}
but I want below output:
{ "contents" : [ { "a" : "A" , "b": "B", "c" : "C" } ] , "maxsize" : 5, "startIndex" : 1, "status" : "suspended", "activated" : false}
Any help is much appreciated!