fastjson中List和JSONArray的相互转换

https://blog.csdn.net/xiaofei__/article/details/89571320

 

(1)List转换为JSONArray

List list = new ArrayList();
JSONArray array= JSONArray.parseArray(JSON.toJSONString(list));

 


(2)JSONArray转换为List

JSONArray array = new JSONArray();
List list = JSONObject.parseArray(array.toJSONString(), EventColAttr.class); 

你可能感兴趣的:(fastjson中List和JSONArray的相互转换)