fastjson List转JSONArray以及JSONArray转List

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


2.fastjson  JSONArray转List
JSONArray array = new JSONArray();
List<EventColAttr> list = JSONObject.parseArray(array.toJSONString(), EventColAttr.class);


3.fastjson  字符串转List
String str = "";
List<T> list = JSONObject.parseArray(str,T.class);
---------------------
作者:可爱的老狗比
来源:CSDN
原文:https://blog.csdn.net/u014736629/article/details/80521581
版权声明:本文为博主原创文章,转载请附上博文链接!

posted on 2019-04-10 10:14  天天天12345  阅读(2216)  评论(0编辑  收藏  举报

导航