Developer Tools
JSON to XML Converter
Convert JSON into well-formed, indented XML for SOAP services, legacy systems, RSS feeds and configuration files. Arrays, nested objects, attributes and special characters are handled automatically.
Convert JSON to XML
Paste JSON, set the root element name and press Convert.
How to Convert JSON to XML
- Paste your JSON or open a .json file.
- Set the name of the root element. XML documents must have exactly one root. Leave it empty if your JSON already has a single top-level key you want to use as the root.
- Choose the element name for items inside arrays, then press Convert to XML.
Conversion Rules
| JSON | XML |
|---|---|
{"name": "Ali"} | <name>Ali</name> |
{"tags": ["a", "b"]} | <tags>a</tags><tags>b</tags> |
{"items": [{...}, {...}]} | <items><item>…</item><item>…</item></items> |
{"@id": "7"} | Attribute: id="7" |
{"#text": "Hello"} | Element text content |
null | Empty element <tag/> |
Keys that are not valid XML names, such as names starting with a number or containing spaces, are adjusted: invalid characters become underscores and a leading underscore is added where needed. Special characters such as &, < and quotes are escaped so the XML is always well-formed.
Privacy
Conversion happens in your browser and nothing is uploaded.
Frequently Asked Questions
How do I create XML attributes from JSON?
Prefix the key with @, for example {"@id": "42"}. It becomes id="42" on the parent element.
How are JSON arrays converted?
Arrays of objects are wrapped in a parent element with one child per item, named with the "array items" setting. Arrays of simple values repeat the element for each value.
Why was my key renamed?
XML element names cannot start with a number or contain spaces and most symbols, so invalid characters are replaced with underscores.
Is my JSON uploaded?
No. Conversion runs in your browser.