M.J.
M.J.

Reputation: 16666

How to generate Json compatible POJO from xsd

I have been using xsd to prepare data transfer model. By now we were ok to use XML format and hence were using xjc to generate the same (using maven plugin).

Now we need to move way from XML and use Json. Is there a plugin or better way with which u still use xsd and generate Json compatible model with proper annotations like @JsonRootName, @JsonInclude etc.

Upvotes: 12

Views: 5686

Answers (1)

TacheDeChoco
TacheDeChoco

Reputation: 3913

Jackson 2 is able to recognize JAXB annotations (which are generated by xjc): https://github.com/FasterXML/jackson-modules-base/tree/master/jaxb

So by using Jackson as preferred serializer, all your existing Pojo's will automatically - and with no cost - become JSON friendly !

Upvotes: 2

Related Questions