I\'m generating POJOs from XSDs using JAXB. And I\'m using Jersey/Jackson to serialize the POJOs to JSONs. For the whole project, I\'ve created an ObjectMapper that has In
If you just want to add one annotation, consider using my JAXB2 Annotate Plugin. See, for instance, this example, specifically this bindings file.
In your case the bindings will look something like:
@org.codehaus.jackson.map.annotate.JsonSerialize
(include=org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.ALWAYS)
(Not tested, just a sketch.)
Few hints:
SO disclaimer: I am the author of the mentioned plugin.