import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.json.JSONArray; import org.json.JSONML; import org.json.JSONObject; public class MyTest { /** * @param args */ public static void main(String[] args) { //{"stooge":"Shemp","map":null,"stooges":["Curly","Larry","Moe"],"collection":[], //"stoogearray":[["Curly","Larry","Moe"]],"array":[null,null]} //{"stooge":"Shemp","stooges":["Curly","Larry","Moe"],"stoogearray":["Curly","Larry","Moe"],"array":[]} /* Collection collection = new ArrayList(); Map map = new HashMap(); JSONObject jsonobject = new JSONObject(map); JSONArray jsonarray = new JSONArray(collection); jsonobject.put("stooge", "Joe DeRita"); jsonobject.put("stooge", "Shemp"); jsonobject.accumulate("stooges", "Curly"); jsonobject.accumulate("stooges", "Larry"); jsonobject.accumulate("stooges", "Moe"); jsonobject.accumulate("stoogearray", jsonobject.get("stooges")); jsonobject.put("map", map); jsonobject.put("collection", collection); jsonobject.put("array", jsonarray); jsonarray.add(map); jsonarray.add(collection); System.out.println(jsonobject.toString()); String string = " Basic bread Flour Yeast Water Salt Mix all ingredients together. Knead thoroughly. Cover with a cloth, and leave for one hour in warm room. Knead again. Place in a bread baking tin. Cover with a cloth, and leave for one hour in warm room. Bake in the oven at 180(degrees)C for 30 minutes. "; jsonobject = JSONML.toJSONObject(string); System.out.println(jsonobject.toString()); System.out.println( JSONML.toString(jsonobject)); jsonarray = JSONML.toJSONArray(string); System.out.println(jsonarray);*/ JSONObject jsonobject = new JSONObject(); JSONObject localobj = new JSONObject("{\"a\":\"true\",\"b\":true,'c':20,'d':'20'}"); // localobj.put("a","true"); // localobj.put("b",true); System.out.println(localobj.toString()); } }