`
mybwu_com
  • 浏览: 177751 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

net.sf.json.JSONException: 'object' is an array. Use JSONArray instead

 
阅读更多

list集合转换JSON出错误

意思是:对象是一个数组。使用jsonarray代替。

解决方法:

将JSONObject替换为JSONArray

代码:

JsonConfig jsonConfig = new JsonConfig();

jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);

JSONArray json = JSONArray.fromObject(newList, jsonConfig);

result = json.toString();


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics