fastjson教程 List转JSONArray以及JSONArray转List

转: 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<T> list = JSONObject.parseArray(array.toJSONString(), T.class);


3.fastjson  字符串转List
String str = "";
List<T> list = JSONObject.parseArray(str,T.class);

posted @ 2022-07-27 17:56  BBS_自律  阅读(448)  评论(0)    收藏  举报