JSON to XML converter
Convert JSON objects to well-formed XML documents. JSON keys become XML element names, values become text content. Runs entirely in your browser.
JSON input
XML output
How JSON to XML conversion works
Each JSON key becomes an XML element name, and each value becomes the text inside that element. Nested objects become nested elements. An array becomes a set of repeated elements that share its key name. The whole document is wrapped in a <root> element, which is fixed in this tool.
Example
This JSON object:
{"user":{"name":"Ada","roles":["admin","dev"]}}
converts to:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<user>
<name>Ada</name>
<roles>admin</roles>
<roles>dev</roles>
</user>
</root>
Limitations
- Text is escaped for
&,<and>, so ordinary values stay well-formed. - A top-level array produces several root elements, which is not valid XML. Wrap the array in an object first.
- Keys must be valid XML element names. A key with a space, or one that starts with a digit, produces invalid XML.
- JSON values are written as element text only. The tool does not create XML attributes.