krampstudio
krampstudio

Reputation: 3611

jackson exclude subclass field

Given the follwing POJO:

class A {
 private String name;
 private String desc;
 private List<A> subclasses;
}

I would produce that kind of json, by excluding a the field desc` from the subclass :

{
 name : "aname"
 desc: "adesc",
 subclasses : [{
      name : "aname"
 },{
      name : "anotherame"
 }]
}

Or a field from the parent class and not from the child class

Upvotes: 1

Views: 1688

Answers (1)

Related Questions