list集合轉換JSON出錯誤
意思是:對象”是一個數組。使用jsonarray代替。
解決方法:
將JSONObject替換爲JSONArray
代碼:
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
JSONArray json = JSONArray.fromObject(newList, jsonConfig);
result = json.toString();