About this tool
Paste XML from an API, an RSS feed, a config file or a SOAP response and get JSON you can work with in JavaScript, Python or any JSON tool. The XML is parsed by your browser’s own XML parser, so malformed documents are reported with the line and column of the problem, and nothing is uploaded.
How XML maps to JSON
XML and JSON don’t line up one-to-one, so the converter follows the most common convention:
- Elements become keys, with the root element as the top-level key:
<user><name>Ada</name></user>→{"user": {"name": "Ada"}}. - Attributes get a prefix so they can’t clash with child elements:
<user id="7">→"@id": 7. - Text next to attributes or children goes under
#text:<price currency="EUR">9.99</price>→{"@currency": "EUR", "#text": 9.99}. - Repeated elements become arrays. Because a list with one item looks like a single element, choose Every child element if your code always expects arrays.
- Values:
true,falseand numbers become JSON types; numbers with leading zeros (like ZIP codes) and long IDs stay strings so nothing is lost. CDATA is treated as text, comments and processing instructions are dropped, and empty elements becomenull.
To go the other way, use JSON to XML.
FAQ
How do I convert XML to JSON?
Paste the XML above. The JSON appears as you type; copy it or download it as a .json file.
How are XML attributes converted?
As keys with a prefix, @ by default, so <item id="1"> becomes "@id": 1. You can change the prefix or ignore attributes.
Why is a list sometimes an object instead of an array?
An element that appears once can’t be told apart from a one-item list. Choose “Every child element” to always get arrays.
Does it support namespaces?
Yes. Prefixed names like soap:Body are kept by default; turn on “Strip namespace prefixes” to use the local names only.
Is my XML uploaded?
No. It is parsed by your browser.