object' is an array. Use JSONArray instead

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lp15203883326/article/details/82972439

list集合转换JSON出错误

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

解决方法:

将JSONObject替换为JSONArray

代码:

JsonConfig jsonConfig = new JsonConfig();

jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);

JSONArray json = JSONArray.fromObject(你的list, jsonConfig);

result = json.toString();

猜你喜欢

转载自blog.csdn.net/lp15203883326/article/details/82972439