XML to JSON Converter
Convert XML documents into predictable, structured JSON — attributes, text content and repeated elements included.
About this tool
XML is richer than JSON: it has attributes, mixed content and repeated elements. This converter
maps all of that onto a clear JSON convention — attributes are prefixed with
@, element text is stored under #text, and elements that repeat under
the same name become arrays. The document must be well-formed; the converter reports parser
errors otherwise.
How to use it
- Paste your XML, or click Sample.
- Click Convert to JSON — the output is pretty-printed.
- Use ⇅ Output → Input to feed the JSON straight into another tool, e.g. the JSON formatter.
Good to know
- CDATA sections are treated as text content.
- Whitespace-only text between elements is ignored; surrounding whitespace in mixed content is trimmed.
- The root element becomes the top-level key of the result object.