How to use the XML to JSON Converter
- Paste XML into the left box, or click Load sample.
- The JSON appears on the right as you type.
- Tick Detect numbers & booleans to turn
<price>120</price>into a number. - Choose the indent and click Copy.
How XML maps to JSON
| XML | JSON |
|---|---|
<name>Ann</name> | "name": "Ann" |
Attribute id="7" | "@id": "7" |
| Text next to attributes or child elements | "#text": "…" |
| The same element repeated | An array: "item": [ … , … ] |
Empty element <note/> | "note": null |
This is the common "@ and #text" convention used by many libraries, so the JSON converts back to the same XML with the other tool.
Frequently asked questions
Is my XML uploaded?
No. It's parsed by your browser's own XML parser.
Why is one element an array and another not?
Elements that appear more than once under the same parent become arrays. A single element stays a plain value. Tick Always use arrays for a consistent shape.
What happens to namespaces?
Prefixes are kept as part of the name, like "soap:Body", and xmlns declarations become @ attributes.
Updated