Convert JSON to XML
Turn a JSON object into an indented XML document.
JSON input
Paste text or drop a file here (up to 50 MB).
XML result
Convert the other way: XML to JSON
Free to use. Your input stays in this browser.
How to use it
- Paste JSON or drop a .json file.
- Choose the XML indentation.
- Copy the result or download it as an .xml file.
Mapping: "@id": "1" becomes the attribute id="1", "#text" becomes the element text, an array repeats the element for each item, and null becomes an empty element such as <note/>.
A JSON object with one key becomes the root element. Anything else, such as an array or an object with several keys, is wrapped in <root>. Keys that are not valid XML names are adjusted, so "first name" becomes <first_name>.
Example
{"catalog":{"book":[{"@id":"b1","title":"XML Basics","price":{"@currency":"USD","#text":"29.99"}},{"@id":"b2","title":"Fish & Chips","price":{"@currency":"EUR","#text":"12.50"}}]}}<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<book id="b1">
<title>XML Basics</title>
<price currency="USD">29.99</price>
</book>
<book id="b2">
<title>Fish & Chips</title>
<price currency="EUR">12.50</price>
</book>
</catalog>