XML to DTO Generator
Guide: Turn JSON or XML Into Classes (DTOs) in Java, C# and More
Nothing you enter or choose here leaves your device. This tool runs in your browser.
How to use
- 1Paste an XML document into the input box.
- 2Choose the language and, if you like, a root class name and package.
- 3Turn annotations on to get JAXB, XmlSerializer or Jackson XML mappings.
- 4Click Copy code and paste it into your project.
Frequently asked questions
How are attributes and elements mapped?
Attributes and child elements both become fields, and with annotations on, each keeps its original XML name and kind (for example @XmlAttribute or @XmlElement). Text next to attributes or child elements becomes a field named value.
How does it know when an element is a list?
An element that appears more than once under the same parent becomes a list. If your sample has only one <item>, it is treated as a single object, so include two or more in the sample to get a list.
Does it read numbers and booleans?
Yes, by default, so 42 becomes an integer and true becomes a boolean. Turn off "Detect numbers and booleans" to make every field a string.
Is my XML uploaded anywhere?
No. It is parsed and converted in your browser, and nothing is sent to a server.
Read the guide
Learn how this works and how to get the most from it.
Developer
Turn JSON or XML Into Classes (DTOs) in Java, C# and More
What a DTO is, how generated classes map JSON and XML, and the details to check before you trust a generated model.
1 min read
Related tools
JSON to DTO Generator
Turn JSON into Java, C#, TypeScript, Kotlin, Python or Go classes.
JSON Formatter & Validator
Prettify, minify and validate JSON, with error line numbers.
Text Diff Checker
Compare two texts side by side and see exactly what changed.
Base64 & URL Encoder / Decoder
Encode and decode Base64 and URL-encoded text instantly.