Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jackson: Generate Jackson classes from XSD

Similar to JAXB generating JAXB classes to a given XSD, does Jackson provide any utility to generate Jackson classes from XSD or JSON.

JAXB class geberator has generated a set of classes for XSD schema defined. For example, for polymorphic types JAXB has the following annotation to identify the name based on XML Element name.

@XmlElements({
    @XmlElement(name = "Dog", type = Dog.class),
    @XmlElement(name = "Cat", type = Cat.class)
})
protected List<Animal> animal;

Is it possible to create similar classes in Jackson. ie., to identify the type based in XML element name.

like image 786
dinup24 Avatar asked Nov 18 '25 14:11

dinup24


1 Answers

Jackson itself does not provide a direct tool like JAXB's xjc for generating classes from an XSD.

You can use tools like jsonschema2pojo to generate POJOs from JSON Schema or JSON, which will use Jackson annotations

like image 194
Sandeep Nair Avatar answered Nov 20 '25 02:11

Sandeep Nair



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!