net.sf.json.JSONException: 'object' is an array. Use JSONArray instead
2016-11-25 17:41
851 查看
list集合转换JSON出错误
意思是:对象”是一个数组。使用jsonarray代替。
解决方法:
将JSONObject替换为JSONArray
代码:
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
JSONArray json = JSONArray.fromObject(newList, jsonConfig);
result = json.toString();
意思是:对象”是一个数组。使用jsonarray代替。
解决方法:
将JSONObject替换为JSONArray
代码:
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
JSONArray json = JSONArray.fromObject(newList, jsonConfig);
result = json.toString();
相关文章推荐
- net.sf.json.JSONException: 'object' is an array. Use JSONArray instead
- net.sf.json.JSONException: 'object' is an array. Use JSONArray instead
- net.sf.json.JSONException: 'object' is an array. Use JSONArray instead
- 扰人的异常:net.sf.json.JSONException: Object is null
- net.sf.json.JSONException: Object is null
- net.sf.json.JSONException: Object is null
- net.sf.json.JSONException: Object is null
- net.sf.json.JSONException: Object is null
- net.sf.json.JSONException: There is a cycle in the hierarchy!
- net.sf.json.JSONException: There is a cycle in the hierarchy
- net.sf.json.JSONException: There is a cycle in the hierarchy
- net.sf.json.JSONException: There is a cycle in the
- net.sf.json.JSONException: There is a cycle in the hierarchy异常的解决方法
- org.JSONObeject,org.JSONArray,net.sf.JSONObject方法的使用,用java解析json数据的方法
- 错误: java.io.NotSerializableException: net.sf.json.JSONObject 的解决方法
- net.sf.json.JSONException: There is a cycle in the hierarchy!
- net.sf.json.JSONException: There is a cycle in the hierarchy!
- net.sf.json.JSONException: There is a cycle in the hierarchy!错误解决方案
- jQuery调用JSON时,net.sf.json.JSONException: There is a cycle in the hierarchy
- jQuery调用JSON时,net.sf.json.JSONException: There is a cycle in the hierarchy!