JSON to XML
Convert JSON to well-formed XML with attributes, repeated elements and correct escaping — round-trips with our XML to JSON tool. All local, all instant.
This tool runs entirely in your browser. Your data never leaves your device — it is not uploaded to any server.
How to use
- 1Paste your JSON into the input box.
- 2The XML appears live — set a custom root element name if you need one.
- 3Copy the result or download it as an .xml file.
JSON to XML
Paste JSON and get a pretty-printed XML document with a proper declaration and 2-space indentation. Objects become elements, arrays repeat their key once per item, and "@key" members become XML attributes — the exact inverse of our XML to JSON converter, so data can go there and back.
Everything is escaped by the book (& < > " ') and arbitrary keys are coerced into legal element names, so the output is always well-formed XML. Values XML cannot express — null, empty arrays — become empty elements, and the limits are spelled out below.
Frequently asked questions
How do attributes and arrays map to XML?
A key starting with @ (or @_) becomes an attribute of its parent element, and "#text" becomes the element's text content — matching what our XML to JSON tool emits. Arrays repeat the same element once per item; a JSON array at the very top is wrapped as <root><item>…</item></root> because a document needs a single root.
What are the limits of the JSON ⇄ XML mapping?
XML has no notation for null or for empty arrays — both collapse to empty elements. Mixed content (text interspersed with child elements) cannot round-trip: text is kept as one block. And when parsing back, a lone repeated element becomes a plain value rather than a one-item array.
What happens to keys that aren't valid XML names?
They are coerced: illegal characters become underscores and a key starting with a digit gets a leading underscore ("2fa" → <_2fa>). CJK and accented letters are already legal XML names and are kept as-is.
Related tools
XML to JSON
Convert XML to JSON in your browser — attributes become @-keys, repeated elements become arrays, and malformed input gets a friendly line-level error.
All tools →
XML Formatter
Beautify XML online with clean 2-space indentation — sitemaps, RSS feeds, SOAP envelopes and config files become readable again, right in your browser.
All tools →
JSON Formatter
Format and beautify messy JSON online — 2 spaces, 4 spaces or tabs, with instant validation and precise error locations. 100% in your browser.
All tools →
JSON Validator
Validate JSON instantly with precise error line and column. Catch missing commas, unquoted keys, trailing commas and bad escapes before they break your app.
All tools →
Embed this tool
Put this tool on your own site with one line — it runs entirely in the visitor's browser.
<iframe src="https://zoyku.com/en/tools/json-to-xml?embed=1" width="100%" height="640" style="border:0;border-radius:16px" title="Zoyku — json-to-xml" loading="lazy"></iframe>