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);
————————————————
原文链接:https://blog.csdn.net/u014736629/article/details/80521581

本文详细介绍使用fastjson库在Java中实现List与JSONArray的相互转换方法,包括List转JSONArray、JSONArray转List以及字符串直接转List的具体代码示例。

941

被折叠的 条评论
为什么被折叠?



