用json-lib将list对象转成json串时提示"There is a cycle in the hierarchy!"
按照网上的解决方法加JsonConfg配置 JsonConfig config = new JsonConfig();
config.setJavaPropertyFilter(new PropertyFilter(){
public boolean apply(Object arg0, String arg1, Object arg2) {
if(arg1.equals("children")||arg1.equals("parent")){
return true;
}else{
return false;
}
}--但结果还是一样的
实体类Module中有:
private Module parent;
private Set<Module> children = new HashSet<Module>(0);