JSONArray ja = new JSONArray();
ja.put("11");
ja.put("22");
ja.put("33");
JSONArray ja2 = new JSONArray();
ja2.put("aa");
ja2.put("bb");
ja.put(ja2);
System.out.println(ja.toString());
// jsonarray which represents the set of the left and right []
// ["11","22","33",["aa","bb"]]
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("aaa", "111");
jsonObject.put("bbb", "222");
jsonObject.put("ccc", "333");
jsonObject.put("ddd", "444");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(jsonObject.toString());
// jsonObject is the middle of a: number, then the left and right sides are {}
// {"ddd":"444","ccc":"333","bbb":"222","aaa":"111"}