How to convert JSON to XML and XML to JSON
- Pick the direction: JSON to XML or XML to JSON.
- Paste your data into the left box, or click Open File.
- Click Copy or Download to save the result.
How JSON maps to XML
| JSON | XML |
|---|---|
{ "name": "Ana" } | <name>Ana</name> |
{ "item": ["a", "b"] } | <item>a</item><item>b</item> |
{ "order": { "@id": "7" } } | <order id="7"/> |
{ "note": { "@lang": "en", "#text": "Hi" } } | <note lang="en">Hi</note> |
An XML document needs a single outer element, so the JSON is wrapped in one. You can name it in the box under the converter. Keys that start with @ become attributes, and #text holds the text of an element that also has attributes. Converting XML to JSON uses the same rules in reverse, and elements that repeat become a list.
When you need this
- Older systems and SOAP services that only accept XML.
- Feeds and sitemaps, such as RSS, that are written in XML.
- Reading an XML export in a tool or script that works with JSON.
Things to know
Characters that are not allowed in XML element names, such as spaces, are replaced with underscores. The symbols &, < and > inside values are escaped so the result is always valid XML. Comments and processing instructions in XML are not carried into JSON.
Your data stays on your device
The conversion runs entirely in your web browser. Nothing you paste or open is sent to a server, so it is safe to use with customer lists, exports and other private data. There is no sign-up and no size limit beyond what your device can handle.
Frequently asked questions
How do I convert JSON to XML?
Paste the JSON in the left box. The XML appears on the right, ready to copy or download.
Can it convert XML to JSON?
Yes. Click XML to JSON above the boxes and paste your XML.
How are XML attributes shown in JSON?
As keys that start with @, for example "@id". Text next to attributes is stored under "#text".
Is my data uploaded?
No. The conversion runs in your browser and nothing is sent to a server.