JSON to XML Converter
Convert JSON to XML online - paste JSON and get well-formed, indented XML instantly.
About JSON to XML
Convert JSON into well-formed XML - useful for SOAP services, legacy enterprise systems and any tool that only accepts XML.
- Paste your JSON into the left editor, or upload a .json file.
- Click Convert to XML.
- The XML appears on the right - copy it or download it as
output.xml. - If the JSON is invalid you get the parser's error message; fix it and convert again.
- The document is wrapped in a
<root>element, because XML needs exactly one root. Rename it after converting if your schema expects another name. - Going the other way? Use the XML to JSON converter.
Convert JSON to XML Online
Paste JSON and get equivalent XML: every key becomes an element, nested objects become nested elements and arrays become repeated <item> elements. Special characters are escaped so the result is always well-formed.
JSON to XML example
{
"title": "web-app",
"version": "1.4.0",
"private": true,
"replicas": 3,
"ports": [
80,
443
],
"owner": null,
"database": {
"host": "db.example.com",
"port": 5432,
"pool": {
"min": 2,
"max": 10
}
},
"servers": [
{
"name": "alpha",
"ip": "10.0.0.1"
},
{
"name": "beta",
"ip": "10.0.0.2",
"role": "backup"
}
]
}<?xml version="1.0" encoding="UTF-8"?>
<root>
<title>web-app</title>
<version>1.4.0</version>
<private>true</private>
<replicas>3</replicas>
<ports>
<item>80</item>
<item>443</item>
</ports>
<owner xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<database>
<host>db.example.com</host>
<port>5432</port>
<pool>
<min>2</min>
<max>10</max>
</pool>
</database>
<servers>
<item>
<name>alpha</name>
<ip>10.0.0.1</ip>
</item>
<item>
<name>beta</name>
<ip>10.0.0.2</ip>
<role>backup</role>
</item>
</servers>
</root>How JSON maps to XML
- Objects: each key becomes a child element; an empty object becomes a self-closing element.
- Arrays: each entry becomes an
<item>element inside the element named after the key. - Values: strings, numbers and booleans become element text, with
&,<,>and quotes escaped.nullbecomes an empty element markedxsi:nil="true". - Names: characters that are not allowed in XML element names are replaced with
_, and names starting with a digit get a leading_.
Common reasons to convert JSON to XML
- Sending data to SOAP or other XML-only web services
- Feeding legacy enterprise, banking or ERP systems
- Building RSS-style feeds and XML configuration files
- Preparing test fixtures for XML parsers and XSLT
JSON to XML FAQ
Does the converter create XML attributes?
No. JSON has no notion of attributes, so every key becomes an element. That keeps the conversion predictable and loss-free.
How are JSON arrays represented in XML?
As repeated <item> elements inside the array's element. For example "ports": [80, 443] becomes a <ports> element containing two <item> elements.
What happens to keys that are not valid XML names?
They are adjusted so the output stays well-formed: characters such as spaces are replaced with _, and a name that starts with a digit gets a leading _.
Is my JSON uploaded to a server?
No. The conversion runs entirely in your browser.