取值
JSONObject parameter={"identify":"accountNumber","credential":"password"}
String identify = parameter.getStr("identify");
String credential = parameter.getStr("credential");
存值
JSONObject jsonObject = new JSONObject();
存字符串、数字
//数字
jsonObject.append("code", 200);
//字符串
jsonObject.append("msg", "成功");
存josn
//新建JSONObject
JSONObject loginResult = new JSONObject();
loginResult.append("example1", "a");
loginResult.append("example2", "b");
jsonObject.append("loginResult",loginResult);
存数组
//数组
List<Object> list = new ArrayList<Object>();
list.add(1);
list.add(2);
list.add(3);
jsonObject.append("menus",list);