专栏名称: xcbeyond
架构师
目录
相关文章推荐
秋叶PPT  ·  这才是用DeepSeek做PPT的正确姿势, ... ·  昨天  
旁门左道PPT  ·  PPT图片不够宽,一拉就变形,咋整? ·  昨天  
跟我学个P  ·  领导说,紫色的PPT很有韵味 ·  3 天前  
跟我学个P  ·  橙色的PPT怎么做得高级? ·  2 天前  
51好读  ›  专栏  ›  xcbeyond

JSON解析问题:JSONException: There is a cycle in the hierarchy | Java Debug 笔记

xcbeyond  · 掘金  ·  · 2021-05-10 13:23

正文

阅读 12

JSON解析问题:JSONException: There is a cycle in the hierarchy | Java Debug 笔记

本文正在参加「Java主题月 - Java Debug笔记活动」,详情查看< 活动链接 >

异常问题

当我们在处理 JSON 字符串时,我却遇到了下面这样的异常:

net.sf.json.JSONException: There is a cycle in the hierarchy!
	at net.sf.json.util.CycleDetectionStrategy$StrictCycleDetectionStrategy.handleRepeatedReferenceAsObject(CycleDetectionStrategy.java:97)
	at net.sf.json.JSONObject._fromBean(JSONObject.java:657)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
	at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
	at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
	at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
	at net.sf.json.JSONObject.setInternal(JSONObject.java:2736)
	at net.sf.json.JSONObject.setValue(JSONObject.java:1424)
	at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.java:765)
	at net.sf.json.JSONObject._fromBean(JSONObject.java:699)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
	at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
	at net.sf.json.JSONArray._processValue(JSONArray.java:2513)
	at net.sf.json.JSONArray.processValue(JSONArray.java:2538)
	at net.sf.json.JSONArray.addValue(JSONArray.java:2525)
	at net.sf.json.JSONArray._fromCollection(JSONArray.java:1056)
	at net.sf.json.JSONArray.fromObject(JSONArray.java:123)
	at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:240)
	at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
	at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
	at net.sf.json.JSONObject.setInternal(JSONObject.java:2736)
	at net.sf.json.JSONObject.setValue(JSONObject.java:1424)
	at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.java:765)
	at net.sf.json.JSONObject._fromBean(JSONObject.java:699)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
	at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
	at net.sf.json.JSONArray._processValue(JSONArray.java:2513)
	at net.sf.json.JSONArray.processValue(JSONArray.java:2538)
	at net.sf.json.JSONArray.addValue(JSONArray.java:2525)
	at net.sf.json.JSONArray.element(JSONArray.java:1724)
	at net.sf.json.JSONArray.add(JSONArray.java:1249)
	at net.sf.json.JSONArray.add(JSONArray.java:1245)
复制代码






请到「今天看啥」查看全文