fastjson一个集合被多次引用的问题
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
public class A { private B b; private C c; public B getB() { return b; } public void setB(B b) { this.b = b; } public C getC() { return c; } public void setC(C c) { this.c = c; } }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
public class B { private List<D> dlist; public List<D> getDlist() { return dlist; } public void setDlist(List<D> dlist) { this.dlist = dlist; } }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
public class C { private List<D> dlist; public List<D> getDlist() { return dlist; } public void setDlist(List<D> dlist) { this.dlist = dlist; } }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
public class D { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
D d = new D(); d.setName("张三"); ArrayList<D> dList = new ArrayList<>(); dList.add(d); B b = new B(); b.setDlist(dList); C c = new C(); c.setDlist(dList); A a = new A(); a.setB(b); a.setC(c); String jsonString = JSON.toJSONString(a,SerializerFeature.DisableCircularReferenceDetect); System.out.println(jsonString);