鉴于以下POJO:
class A {
private String name;
private String desc;
private List<A> subclasses;
}
我会通过从子类中排除字段desc`来生成那种json:
{
name : "aname"
desc: "adesc",
subclasses : [{
name : "aname"
},{
name : "anotherame"
}]
}
来自父类的字段,而不是来自子类的字段
答案 0 :(得分:2)