【发布时间】:2012-07-21 22:27:29
【问题描述】:
我正在使用 jackson 2.0 序列化一个引用自身的类。
Class A{
String identifier;
List<A> related;
}
我希望 JSON 看起来像这样:
{ identifier: "name",
related [ identifier: "related to name",
identifier: "also related to name"]
}
基本上我想经历一个递归深度。我试过了
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id")
但只有在有指向原始对象的链接时才会停止递归。我该如何解决这个问题?
【问题讨论】:
标签: json spring-mvc annotations jackson