How to convert JSON to XML
- Paste JSON into the editor, or load a file.
- Click Convert to XML. If the JSON has a syntax error, click Format to see exactly where, and Repair to fix common mistakes.
- Copy or download the XML from the result panel.
How JSON maps to XML
| JSON | XML |
|---|---|
| The whole document | Wrapped in a <root> element |
Object key "name": "Ada" | Element <name>Ada</name> |
| Nested object | Child elements |
Array "tag": ["a", "b"] | Repeated elements <tag>a</tag><tag>b</tag> |
| A top-level array | One <item> element per entry inside <root> |
| Numbers and booleans | Element text, e.g. <active>true</active> |
For example, {"user": {"name": "Ada", "roles": ["admin", "dev"]}} becomes:
<root>
<user>
<name>Ada</name>
<roles>admin</roles>
<roles>dev</roles>
</user>
</root> Things to check
- XML element names can't contain spaces or start with a digit, so JSON keys like
"first name"or"1st"need renaming before converting. - XML has no types: after converting,
42and"42"look the same. Use an XML Schema if the receiving system needs types. - To go the other way, use the XML to JSON converter.
Conversion runs on our server in memory; the data isn't stored.
Frequently asked questions
How are JSON arrays converted to XML?
Each array item becomes an element with the same name as the array key, repeated once per item. A top-level array becomes <item> elements inside <root>.
What is the root element called?
The converted XML is wrapped in a <root> element, because XML needs exactly one top-level element and JSON doesn't name its outer object. Rename it in the result if your system expects another name.
Why does conversion fail for some keys?
XML element names can't contain spaces, start with a digit or contain most punctuation. Rename such keys in the JSON first.
Can I convert XML back to JSON?
Yes, use the XML to JSON converter. Note that a round trip may not give identical JSON, because XML doesn't record types or whether a single element was an array.
Is my data stored?
No. The conversion runs on our server in memory and the result is sent straight back; nothing is saved.