XML Converter
Convert XML to JSON, CSV, YAML, Java, C# or TypeScript, and JSON or CSV back to XML. Runs in your browser.
Runs in your browser. Nothing is uploaded.
How to use the XML Converter
- Choose a conversion under Convert. XML can become JSON, CSV, YAML, Java classes, C# classes or TypeScript types, and JSON or CSV can become XML.
- Paste your input into the left box, open a file, or press Load example for a sample that suits the chosen conversion.
- Adjust the options that appear for it, such as how attributes are named, which element holds each record, or the separator.
- The result updates as you type. Copy it, download it, or press Use result as input to keep working with it.
One tool for getting data in and out of XML
XML is still everywhere: SOAP services, RSS feeds, product feeds, sitemaps, Office files and decades of configuration. Most modern code would rather work with JSON, a spreadsheet or typed classes, and some systems still demand XML back. Each of those trips used to need a separate converter. Here they share one page: paste the input once, then change Convert to see it as JSON, CSV or YAML, or as code.
XML to JSON and YAML
Elements become keys, repeated elements become arrays, and attributes become prefixed keys so they never
collide with child elements. Number and true/false detection turns "42" into 42 where the text is
clearly a value; switch it off to keep every value as a string. YAML output follows the same rules, which
makes it handy for moving old XML settings into a YAML config.
XML to CSV
Spreadsheets want rows and columns, while XML is a tree. The converter picks the repeated element that looks like a record, turns each one into a row, and makes a column for every child element and attribute it finds across all records. Missing values stay empty instead of shifting columns, so the file opens cleanly in Excel, Numbers or Google Sheets.
XML to code
Paste a sample response and get Java classes with Jackson XML annotations, C# classes ready for
XmlSerializer, or TypeScript types that match the JSON produced by this same converter. Repeated
elements become lists and attributes are mapped as attributes, which is the part that is easiest to get
wrong by hand.
JSON and CSV to XML
Going the other way, JSON keys become elements and @-prefixed keys become attributes. Arrays repeat
their parent element, or use the item name you choose when they sit at the top level. CSV rows become
row elements under a root you name, with columns as child elements or attributes.
Check the result
Conversions between formats with different rules are never perfectly lossless: comments, processing instructions and the order of mixed content can’t always survive a round trip. Look over the output once, and use Use result as input with the opposite conversion to confirm the data comes back the way you expect.
Frequently asked questions
How are XML attributes shown in JSON or YAML?
As keys with a prefix, @id by default, so they never clash with child elements of the same name. Pick _ or - if your code prefers it. Text that sits beside attributes or child elements goes under #text.
Why is a single child sometimes an object and sometimes an array?
XML doesn't say whether an element can repeat. With one <item> you get an object, with two you get an array. Tick Always use arrays when your code needs the same shape every time.
Which elements become CSV rows?
By default the converter finds the most frequently repeated element, such as each <book> in a catalog. Type a path like catalog/book under Record element to choose a different one. Child elements and attributes become columns.
What happens to namespaces?
Prefixes are kept as part of the names, for example soap:Body. Tick Drop namespace prefixes to remove them when you only care about the data.
Are the generated classes ready to use?
They are a starting point. Each repeated element becomes a list, attributes and elements carry the right mapping annotations, and number or date types are inferred from the sample. Check names and types against the full schema before committing them.
Is my data uploaded?
No. Every conversion runs in your browser, so internal feeds, SOAP payloads and exports never leave your device.
Tutorials
How to convert an XML API response to JSON
Turn XML orders into JSON with real numbers and consistent arrays, ready to use in JavaScript or Python.
How to create an XML product feed from a spreadsheet
Export products from a spreadsheet as CSV and convert them into an XML feed with named root and product elements.
How to open XML data in Excel or Google Sheets
Convert an XML export into a CSV file with one row per record, check the columns, and open it in a spreadsheet.