通过数组或者列表生成json数组后添加到json对象中的方法
把一个列表或数组生成json数组并添加到json对象中
String string =JSON.toJSON(数组或者列表).toString();
jsonArray =JSON.parseArray(string);
jsonObject.put("添加的对象名",jsonArray);
手动向json数组中添加对象
JSONObject json = new JSONObject();
json.put("keya1", "heihei");
jsonArray.add(json);//向Json数组对象中添加Json对象
还没有评论,来说两句吧...