JSON解析关联类型发生死循环 There is a cycle in the hierarchy!

解决办法是忽略掉关联类型的数据,使用jsonConfig进行配置,代码如下:

JsonConfig jsonConfig = new JsonConfig();  //建立配置文件

jsonConfig.setIgnoreDefaultExcludes(false);  //设置默认忽略

jsonConfig.setExcludes(new String[]{"glLocation"}); 

JSONArray jsonArray = JSONArray.fromObject(list,jsonConfig);  //加载配置文件

posted @ 2015-04-08 22:07  图书馆电脑维修工  阅读(219)  评论(0编辑  收藏  举报
free hit counters