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

發佈了23 篇原創文章 · 獲贊 41 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章