JSON → XML Converter

Turn JSON into well-formed XML with a mapping you can see and tune.

Your data is processed entirely in your browser and is never uploaded.

Tool workspace

INPUT JSON

Drag & drop file here or browse

Status: Empty0 chars

Options

Indentation

Each array entry is wrapped in this tag.

Ready, paste to start
OUTPUT XML
Output: Empty0 chars
HOW IT WORKS

Convert JSON to XML in three steps

Paste or upload

Drop in any JSON. Validity is checked as you type, up to 15M characters.

Tune the mapping

Set the root tag and the array-item tag, indentation, and the XML declaration.

Convert & export

Click Convert, then copy or download the XML, and watch the element count.

Docs · JSON → XML

Generating XML from JSON

JSON → XML takes any JSON value and builds a well-formed XML document from it. Every object key becomes an element name sanitized to valid XML, nested objects become nested elements, arrays become a wrapper element with repeated children using the Array item tag, null becomes a self-closed element, numbers and booleans become text, and special characters are escaped. You control the root element name, the array item tag, indentation, and whether to include the XML declaration. The conversion runs locally, with no external dependencies.

Things to know

Root element

Every conversion is wrapped in a root element whose name you choose, default root, sanitized to a valid XML name. A JSON object like { "book": { "title": "Dune" } } nests under that root.

Arrays need an item tag

XML has no native arrays, so each array becomes a wrapper element named after its key with one child per entry using the Array item tag you set, default item. With that default, "tags": ["a", "b"] becomes <tags><item>a</item><item>b</item></tags>.

Null becomes self-closed

A null value becomes a self-closed element like <note/>. An empty object becomes an empty pair <tag></tag>. This keeps the output well-formed without inventing a type.

Key sanitization

XML element names cannot start with a digit or contain spaces. Keys are sanitized to valid names, with illegal characters replaced by underscore and a leading underscore added when needed. If the receiving system expects exact names, rename the keys in JSON first.

XML declaration toggle

Include <?xml version="1.0" encoding="UTF-8"?> when the consumer expects a full document, turn it off for fragments or embedded parsers that reject it.

Escaping

Ampersands, angle brackets, and quotes are escaped to &amp;, &lt;, &gt;, and &quot; so the output stays well-formed. A single unescaped &amp; in a URL is the most common way hand-built XML breaks.

Try these

Simple object
{ "book": { "title": "The Hobbit", "author": "J.R.R. Tolkien" } }

A basic JSON object wrapped in the root you choose.

Arrays and nesting
{ "tags": ["a", "b"], "book": { "title": "Dune" } }

Arrays become repeated item elements inside their wrapper.

Null and empty
{ "note": null, "empty": {} }

Null becomes a self-closed element, empty objects become empty pairs.

pair this withReverse it → XML → JSON·Format the source → JSON Formatter·Validate the source → JSON Validator

FAQ

Frequently asked questions

Is my JSON uploaded anywhere?

No. Conversion runs entirely in your browser, in a background worker for large files. Your data never leaves your machine.

How are arrays represented?

Each entry becomes its own element using the "Array item tag" (default item), wrapped in the array's key. So "tags": ["a","b"] becomes <tags><item>a</item><item>b</item></tags>.

Will it round-trip back to identical JSON?

Not always, and we don't pretend otherwise. XML has no native notion of null vs an empty string, or of a number vs the text of that number, so some type information is lost on the way to XML. The mapping is designed to be readable and reversible where it can be.

Can I convert JSON to XML without uploading?

Yes. The conversion runs entirely in your browser, so your JSON never leaves your machine. Paste your data or drop a file and the XML is produced locally.

How do I convert JSON to XML online?

Paste your JSON into the converter, choose the root name and array item tag if needed, and press Convert. You can then copy the XML or download it as a .xml file. Everything runs locally, so no signup is needed.

Does the converter add an XML declaration?

It can. Turn on Include <?xml …?> to add <?xml version="1.0" encoding="UTF-8"?> for a full document, or turn it off for fragments and embedded parsers that reject it.

What happens to null values?

A null becomes a self-closed element like <note/>. An empty object becomes <tag></tag>. This keeps the output well-formed without inventing a type for null.

What if my JSON key is not a valid XML name?

Keys are sanitized to valid XML names: illegal characters become underscores and a leading underscore is added when a name starts with a digit. If the receiver expects exact names, rename the keys in JSON first.