UTILS.
100% in-browser
}<

JSON to XML

Convert a JSON object into an indented XML document.

— output appears here —

About this tool

JSON to XML is a free, in-browser converter that turns a parsed JSON value into an indented XML document. It reads the input with the browser's own JSON parser, walks the structure, maps object keys to element tags and array items to repeated elements, then wraps the whole tree in a single <root> element beneath a UTF-8 XML declaration.

Primitive values such as strings, numbers and booleans become element text, with ampersands, angle brackets and double quotes escaped as entities; a null becomes a self-closing empty element; nested objects nest as child elements. Indentation is fixed at two spaces per level, and keys are sanitized into valid XML tag names, so characters outside letters, digits, underscore, dot and hyphen turn into underscores.

Click Convert to build the output, where invalid JSON is flagged inline, then Copy to grab the result. Everything runs 100% in your browser: no uploads, no accounts, no tracking, and it works offline.

Frequently asked questions

How are arrays represented?
Each element of the array repeats the same tag name as its key, which is the standard way to model list-like data in XML.
What wraps the output?
Everything sits inside a single <root> element under a <?xml version="1.0" encoding="UTF-8"?> declaration. If the top level is an array or a lone value rather than an object, it is placed inside an <item> element within <root>.
Which characters get escaped?
Inside element text, ampersands, angle brackets and double quotes are converted to the entities &amp;, &lt;, &gt; and &quot; so the values stay well-formed.
What happens to keys that aren't valid XML tag names?
Each key is sanitized: characters other than letters, digits, underscore, dot or hyphen become underscores, and a key that doesn't start with a letter or underscore gets a leading underscore.

More tools