解决办法是忽略掉关联类型的数据,使用jsonConfig进行配置,代码如下:
JsonConfig jsonConfig = new JsonConfig(); //建立配置文件
jsonConfig.setIgnoreDefaultExcludes(false); //设置默认忽略
jsonConfig.setExcludes(new String[]{"glLocation"});
JSONArray jsonArray = JSONArray.fromObject(list,jsonConfig); //加载配置文件
JSON解析关联类型发生死循环 There is a cycle in the hierarchy!
原文:http://www.cnblogs.com/zhengcong/p/4404333.html