fastjson中List和JSONArray的相互转换

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

 

(1)List转换为JSONArray

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

 


(2)JSONArray转换为List

JSONArray array = new JSONArray();
List<EventColAttr> list = JSONObject.parseArray(array.toJSONString(), EventColAttr.class); 
posted @ 2019-12-18 11:10  不打鱼光晒网  阅读(5865)  评论(0)    收藏  举报