How to use the JSON to XML Converter
- Paste JSON into the left box, or click Load sample.
- The XML appears on the right as you type.
- Set the Root element name. It's used when the JSON has more than one top-level key, or is an array.
- Click Copy.
How JSON maps to XML
| 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.
Names that aren't valid XML
XML element names can't start with a digit or contain spaces. Keys like "2024" or "first name" become _2024 and first_name. Special characters in values are escaped, so & becomes &.
Frequently asked questions
Is my JSON uploaded?
No. The conversion runs in your browser.
How do I make an attribute?
Start the key with @: {"item": {"@id": 7, "#text": "Tea"}} becomes <item id="7">Tea</item>.
What happens to arrays at the top level?
Each item becomes an <item> element inside the root.
Updated