java - jackson exclude subclass field -
given follwing pojo:
class="lang-java prettyprint-override">class { private string name; private string desc; private list<a> subclasses; }
i produce kind of json, excluding field desc` subclass :
class="lang-js prettyprint-override">{ name : "aname" desc: "adesc", subclasses : [{ name : "aname" },{ name : "anotherame" }] }
or field parent class , not kid class
to exclude field utilize @jsonignore
annotation. more on here -
http://forum.springsource.org/showthread.php?92684-exclude-bean-field-from-json-response
and here -
http://jackson.codehaus.org/1.0.0/javadoc/org/codehaus/jackson/annotate/jsonignore.html
java json jackson
No comments:
Post a Comment