json出现引用 "$ref": "$.conpolice[2]"

1.

出现这个问题一般是因为代码循环引用出现的问题,可以改变逻辑,也可以直接加上下面加粗的代码

JSONObject jsonObject = new JSONObject();
jsonObject.put("loadwarning", loadwarning);

//避免出现引用   "$ref": "$.map.离心机冷凝气出水报警2"     

String jsonString = JSON.toJSONString(jsonObject, SerializerFeature.DisableCircularReferenceDetect);

response.getWriter().print(jsonObject);

posted @ 2019-10-14 17:46  夏天丷  阅读(337)  评论(0编辑  收藏  举报