~/frontend-tools/xml-to-json-converter
XML to JSON Converter
Paste XML and get clean JSON. Attributes are kept under a prefix you choose, repeated elements become arrays, text content is preserved, and invalid XML gets a clear error with the problem location instead of a silent failure.
Using the XML to JSON Converter
How XML maps to JSON
Each element becomes a property named after its tag. Attributes become properties with a prefix, @id by default, so they cannot clash with child elements. When an element has both attributes and text, the text goes in a #text property; an element with only text becomes a plain value.
Repeated elements
XML allows the same tag many times in a row, JSON needs an array for that. Repeated siblings, such as several <product> elements, are collected into an array automatically.
Types
XML has no data types: everything is text. With type conversion on, values that look like numbers or true and false become JSON numbers and booleans. Turn it off if you need to keep values such as postcodes or IDs with leading zeros as strings.
Privacy and limits
The XML is parsed by your browser's built-in XML parser, so nothing is uploaded and very large files are limited only by your device's memory. Namespaced tags keep their prefix, for example media:content.
Frequently asked questions
Why do I get a parse error?
The XML is not well formed: a tag is not closed, an ampersand is not escaped as &, or there is more than one root element. The error message points to the problem.
Can it convert JSON back to XML?
Not here. The JSON, YAML and CSV converter covers the other common data formats.
Are comments kept?
No. XML comments and processing instructions are not part of the data and are skipped.