🔒 Runs in your browser — nothing is uploaded✓ Free, no signup
JSON to XML Converter
Turn JSON into well-formed, indented XML. Arrays become repeated elements, keys starting with @_ become attributes, and a root element is added when needed.
0 characters
XML
When should you use the JSON to XML Converter?
- Sending data to an XML or SOAP API from a JSON source
- Creating XML config or feed files from JSON data
- Converting API responses for systems that only accept XML
How to use the JSON to XML Converter
- 1
Paste JSON
Paste an object or array into the left editor.
- 2
Name the root
XML needs one root element. If your JSON has several top-level keys or is an array, it's wrapped in the root name you choose.
- 3
Add attributes
Keys that start with @_ become attributes, e.g. "@_id": 1 becomes id="1".
- 4
Copy or download
Copy the XML or download it as a .xml file.
Examples
Array of objects with attributes
JSON
{
"catalog": {
"book": [
{ "@_id": "1", "title": "A" },
{ "@_id": "2", "title": "B" }
]
}
}XML
<catalog>
<book id="1">
<title>A</title>
</book>
<book id="2">
<title>B</title>
</book>
</catalog>Common errors and how to fix them
Invalid JSON- Fix the JSON first — the JSON Validator shows the exact line and column of the error.
Element names look wrong- XML element names can't start with a number or contain spaces. Rename keys like "1st item" to something like firstItem.
More from JSON Tools
Free tools that run in your browser — no signup, nothing uploaded.
JSON Auto-Fixer & Formatter
Repair, validate, and beautify broken JSON (missing quotes, trailing commas).
JSON Validator & Linter
Check JSON syntax and see the exact line and column of every error.
JSON Viewer (Tree)
Explore JSON as a collapsible tree with search and click-to-copy paths.
JSON Editor
Edit JSON with live validation, a tree view, formatting and key sorting.
JSON Beautifier
Pretty-print and indent JSON for easy reading and debugging.
JSON Compare & Diff Tool
Find the difference between two JSON objects visually and quickly.
JSON Sorter (Sort Keys)
Sort JSON object keys alphabetically, including nested objects.
JSONPath Tester
Evaluate JSONPath expressions with filters and recursive queries.
JSON Schema Generator
Generate a JSON Schema from any sample JSON document.
JSON to XML Converter FAQ
Prefix the key with @_ — for example { "book": { "@_id": "1" } } becomes <book id="1"/>. Keys without the prefix become child elements.
Each array item becomes a repeated element with the array's key as its name. A top-level array is wrapped as <root><item>…</item></root>.
XML allows only one top-level element. If your JSON has several top-level keys, or is an array or single value, it's wrapped in the root name you set.
Yes. Characters like &, < and > in values are escaped so the XML stays valid.
Empty values become self-closing elements like <note/>.
No. Conversion runs entirely in your browser.
