Tuesday, 15 September 2015

Ordered JSON String in Android

             JSON   object is an unordered set of name/value pairs.So the Android changes the order of JSON ,To keep the values order use the below code

Map obj=new LinkedHashMap();





   StringWriter out = new StringWriter();

   JSONValue.writeJSONString(obj, out);

   String jsonText = out.toString();

And Download "json simple 1.1 jar" from this link

And add the jar file to your lib folder

Happy Coding:)