Step 1: Add JSON
Paste JSON into the editor, choose Open JSON File, or choose Load Sample JSON. Open JSON File converts as soon as a valid file is read. Load Sample JSON converts immediately.
Paste JSON, name the root element, and convert JSON to XML in your browser. The text stays on this page and is not uploaded.
Convert JSON to see XML here.
This JSON to XML converter wraps your JSON in one root element, then
writes nested objects as nested tags and arrays as repeated tags.
For
{"order": {"id": 1001, "total": 29.5, "items": ["pen", "book"]}}
with root root and 2-space indent, the XML is:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<order>
<id>1001</id>
<total>29.5</total>
<items>pen</items>
<items>book</items>
</order>
</root>
It reads the editor with JSON.parse, then walks the value and writes indented XML. Conversion runs in this browser. The JSON is not uploaded.
Use it when a SOAP API, a legacy system, or an enterprise feed expects XML and you already have JSON. Format the JSON first in the JSON Formatter or inspect it in the JSON Viewer if you need to read the structure before converting.
This page converts JSON to XML only. It does not convert XML back to JSON — that is a separate direction with different conventions. For YAML instead of XML, use the JSON to YAML converter or the YAML to JSON converter.
Paste JSON into the editor, choose Open JSON File, or choose Load Sample JSON. Open JSON File converts as soon as a valid file is read. Load Sample JSON converts immediately.
Name the root element (default root), pick 2-space or 4-space indentation, and keep the XML declaration on unless you need the fragment without it.
Pasted JSON needs Convert to XML. Invalid JSON stays in the editor. The status line explains the problem in plain language, and the XML preview is cleared.
Copy XML converts the current editor text, then copies that XML. Download XML converts the current editor text and saves converted-data.xml. Neither button copies a stale preview. Clear empties both panels.
The mapping is element-only, which is the common convention for this kind of converter.
Each object key becomes a nested element. Nested objects nest further.
{"user": {"name": "Ada"}}
<root>
<user>
<name>Ada</name>
</user>
</root>
Array items share the same tag as the key.
{"items": ["pen", "book"]}
<root>
<items>pen</items>
<items>book</items>
</root>
{"id": 1001, "active": true, "city": "Quetta"}
<root>
<id>1001</id>
<active>true</active>
<city>Quetta</city>
</root>
{"note": null}
<root>
<note />
</root>
Keys that start with a digit or contain spaces are rewritten with underscores so the XML names stay valid.
{"2nd item": 1}
<root>
<_2nd_item>1</_2nd_item>
</root>
Nesting depth is kept. An object inside an array item becomes a nested
element under that repeated tag. The items array below is two
<items> elements; it is not one parent with numbered children.
{
"order": {
"id": 1001,
"items": ["pen", "book"]
}
}
<root>
<order>
<id>1001</id>
<items>pen</items>
<items>book</items>
</order>
</root>
A key that starts with @ becomes an attribute of its parent
element. The @ prefix is dropped from the attribute name.
A key called #text becomes that element’s text content.
{"book": {"@id": "7", "#text": "Dune"}}
<root>
<book id="7">Dune</book>
</root>
Input:
{"order": {"id": 1001, "total": 29.5, "items": ["pen", "book"]}}
Output with 2-space indentation, the XML declaration on, and root
root:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<order>
<id>1001</id>
<total>29.5</total>
<items>pen</items>
<items>book</items>
</order>
</root>
The top-level object is wrapped in <root> because XML needs
exactly one root. order becomes a nested element.
id and total become text elements. The
items array becomes two repeated <items> elements.
Paste your JSON, name the root element (default "root"), and press Convert to XML. The XML appears instantly with a declaration and indentation — copy it with the Copy XML button. Free, no signup.
XML needs exactly one top-level element, so the converter wraps your JSON in one. It defaults to "root" — name it whatever your target system expects, e.g. "catalog" or "response".
Each array item becomes a repeated element with the same tag. ["pen", "book"] under "items" becomes <items>pen</items> followed by <items>book</items>.
Prefix the key with @: {"book": {"@id": "7", "#text": "Dune"}} makes <book id="7">Dune</book>. The @ is dropped from the attribute name.
Null becomes a self-closing tag, e.g. <note />. There is no text to put inside it.
No. The conversion runs entirely in your browser with JavaScript — your JSON is never sent to a server, logged or stored.
Not with this tool — it converts JSON to XML only, because the two directions need different conventions.
The converter tells you in plain language (e.g. a missing comma or an unquoted key) and produces no XML until the JSON parses. Fix the input, then convert again.
Free tool, runs entirely in your browser. Nothing you paste is uploaded or stored.