JSONObject转JSONString:
JSON.toJSONString(jsonObject);
JSONString转JSONObject:
JSONObject.parseObject(jsonString);
从JSONObject中获得JSONArray:
JSONArray jsonArray=jsonObject.getJSONArray(key);
JSONArray转JSONObject再转JSONString:
map.put(key,jsonArray);//通过map转成JSONObject
JSON.toJSONString(map)//再转成JSONString
JSONObject转Record:
record.set(jsonObject);
Record转JSONObject:
JSONObject jsonObject=JSONObject.parseObject(JSON.toJSONString(record.getColumns()));
遍历JSONArray:
for(int i=0;i<jsonArray.size();i++){
JSONObject jsonObject=jsonArray.getJSONObject(i);//通过下标取元素
String str=jsonObject.getString(key);//通过key取JSON对象里的value
}