/* TestJson.java */ import org.json.*; public class TestJson { public static void main(String[] args) { JSONObject jo = new JSONObject(); JSONObject inner = new JSONObject(); try { jo.put("Key1", "Value1"); jo.put("Key2", "Value2"); jo.put("IntKey", 25); inner.put("in1", 2.35); jo.put(new JSONObject().put("in1", 2.35)); } catch (Exception e) { } System.out.println(jo.toString()); System.out.println(inner); } }