XML to Java
Generate Java POJOs or records with Jackson XML annotations from an XML sample.
XML to Java – POJOs for jackson-dataformat-xml
The XML to Java converter builds Java classes for your XML documents, annotated for Jackson's XML module (com.fasterxml.jackson.dataformat:jackson-dataformat-xml). The result can be read with new XmlMapper().readValue(xml, Order.class) and written back with writeValueAsString, with the same object model you might already use for JSON.
How XML maps to types
XML has no native types, so the converter reads every element and attribute value and infers one: whole numbers become integers, decimals become floating-point numbers, true/false become booleans, and everything else stays a string. Attributes are kept apart from child elements (they appear as @name keys internally), an element that has both attributes and text gets a dedicated text field, and repeated sibling elements such as several item nodes become a list. Namespace prefixes are stripped from names so ns:customer and customer produce the same type.
Annotations in the output
@JacksonXmlRootElement(localName = "...")on the root class.@JacksonXmlProperty(isAttribute = true, localName = "...")for XML attributes.@JacksonXmlTextfor the text content of an element that also has attributes.@JacksonXmlElementWrapper(useWrapping = false)on lists of repeated elements, so they are read without an extra wrapper level.
Choose between classic POJOs with getters and setters (works with Spring, JPA and older code) and Java 16+ records for immutable value objects. Turn the Jackson XML annotations switch off if you use JAXB or another binder and only want the plain class skeleton.
Use cases
Integrating with SOAP-era enterprise systems, reading XML exports from ERPs, parsing payment files such as ISO 20022 samples, or mapping configuration documents in a Spring Boot service.
Tips
Each public class must go in its own .java file, or you can paste them as static nested classes. Fields that are missing from some repeated elements are boxed (Integer, Boolean) so they can hold null.
Related tools
Generate Java from JSON with JSON to Java or pretty-print your input with the XML Formatter.
Frequently Asked Questions
Is my XML uploaded anywhere?
No. The XML is parsed and converted by JavaScript running in your browser tab. Nothing is sent to a server, so internal feeds, SOAP payloads and configuration files stay on your machine.
Which dependency do I need?
Add com.fasterxml.jackson.dataformat:jackson-dataformat-xml. Spring Boot projects already manage its version; just add the artifact to pom.xml or build.gradle.
Can I use JAXB instead?
Turn off "Jackson XML annotations" to get plain classes, then add @XmlRootElement, @XmlAttribute and @XmlElement from jakarta.xml.bind by hand; the structure and types stay the same.
Why are some fields Integer instead of int?
Optional elements and attributes are generated with boxed types so that a missing value maps to null instead of a misleading 0 or false.