How to use the XML to JSON Converter
- Paste your XML into the left box, or open a file.
- Adjust the options if you need to.
- Copy the JSON or download it as a file.
What does this tool do?
The XML is parsed by your browser's built-in XML parser, which also validates that it's well-formed. Attributes are kept as @name keys, text alongside child elements as #text, and repeated child elements become arrays.
Why use it?
- Work with XML APIs and feeds in JavaScript.
- Inspect RSS, sitemaps and SVG metadata.
- Clear error messages for broken XML.
Example
<book id="1"><title>Dune</title></book> becomes {"book": {"@id": "1", "title": "Dune"}}
Privacy
Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.
Frequently asked questions
How are XML attributes shown in the JSON?
Attributes become keys starting with @, so <item id="5"> turns into an “@id” key. Text that sits alongside child elements is kept under “#text”.
Why is an element sometimes an array and sometimes an object?
Repeated child elements become an array, but a single child stays an object. If your code expects an array, handle the single-item case — this is a common surprise with any XML-to-JSON conversion.
Last reviewed by the M2Toolkit team.