杰克逊是否处理/抛出像net.sf.json.JSONException 这样的循环异常:层次结构中有一个循环!当它检测到要在 json 中转换的 java 对象中的循环时,在 json-lib 中抛出。如果是这样,我们该如何处理。
json-lib 中抛出的错误如下
1169 SEVERE: Servlet.service() for servlet JSONControllerServletGZIP threw exception
1170 net.sf.json.JSONException: There is a cycle in the hierarchy!
1171 at net.sf.json.util.CycleDetectionStrategy$StrictCycleDetectionStrategy.handleRepeatedReferenceAsArray(CycleDetectionStra
1172 at net.sf.json.JSONArray._fromCollection(JSONArray.java:749)
1173 at net.sf.json.JSONArray.fromObject(JSONArray.java:165)
1174 at net.sf.json.JSONObject._processValue(JSONObject.java:2132)
1175 at net.sf.json.JSONObject._setInternal(JSONObject.java:2177)
1176 at net.sf.json.JSONObject.setValue(JSONObject.java:1005)
1177 at net.sf.json.JSONObject._fromMap(JSONObject.java:886)
1178 at net.sf.json.JSONObject.fromObject(JSONObject.java:248)
提前致谢。