首页 > 代码库 > 【Other】关于There is a cycle in the hierarchy!

【Other】关于There is a cycle in the hierarchy!

原因:

  父对象与子对象互相包含对方的类型的属性,造成死循环

解决方案1:

  JsonConfig config=new JsonConfig();

  config.setExcludes(new String[]{"devTask","employee","probClient"});  //传入要忽略的属性数组

  JSONObject json=JSONObject.fromObject(new Object(),config);    

 

  

  

 

  

 

【Other】关于There is a cycle in the hierarchy!