All processing happens in your browser. Your file is never uploaded to any server.
Paste JSON
Upload File

Click to select or drag & drop a .json file

All conversion runs in your browser. Your data is never uploaded to any server.

JSON to XML

This free JSON to XML converter turns JSON into XML entirely in your browser. Paste your data or upload a .json file, review the result, and download it. Nothing leaves your device, and there is no sign-up.

Going this direction is not simply the previous conversion run backwards. JSON does not record which keys started life as attributes, a namespace URI is often already gone, and plenty of JSON keys are not legal XML names at all. This page states how it handles each of those, and lets you set every one of them yourself.

How to use this JSON to XML converter

Conversion rules — exactly what this page does

Root element

Every XML document needs exactly one root. If your JSON is an object with a single top-level key, that key becomes the root element name. Otherwise — an array at the top level, or an object with several keys — the name in the Root element field is used, which defaults to root. Type any name you like into the field and it wins.

A top-level array has no name of its own, so each item is written as an <item> element inside the root: [1,2] becomes <root><item>1</item><item>2</item></root>.

Attributes

A key is written as an attribute when it starts with the chosen prefix — @ by default, so "@id": "b1" becomes id="b1". Switch the prefix to _ if your JSON uses that. Choose None and no key is treated as an attribute; every key becomes a child element. There is no way to detect attributes without a prefix, because JSON does not mark them — that is stated rather than guessed.

Arrays — repeated elements

Note the consequence: with repeated elements, a one-item array and a plain value produce identical XML. That is inherent — XML has no array type — so if the difference matters downstream, use the wrapper mode.

Text, numbers and empty values

Escaping

Text is escaped as &amp;, &lt; and &gt;; attribute values additionally escape &quot;. Newlines and tabs inside an attribute value are written as &#10; and &#9;, because XML would otherwise normalise them to a single space when the file is read back. Tick CDATA for & < to wrap text containing & or < in a CDATA section instead.

Namespaces — the mirror of the XML to JSON page

Illegal XML names

JSON allows key names that XML forbids — 1st, unit price, a/b, an empty string. Those are sanitised: forbidden characters become _, and a name that does not start with a letter or underscore gets one prepended. The count of renamed keys is shown under the result, so a silent rewrite never happens.

What this tool supports

Limits — read this before pasting something huge

Privacy

Uploaded files are read with the browser's own file reader and never leave your device. There is no upload endpoint on this page, no account, and no stored history. You can disconnect from the internet after the page loads and it will still work.

FAQ

Is this JSON to XML converter free?

Yes. It is free with no login and no usage limit, and all processing stays in your browser. For the opposite direction see the XML to JSON converter; other formats are handled by the JSON to CSV converter, the CSV to JSON converter, the JSON to Excel converter and the CSV to Excel converter.

Do I have to upload my JSON file?

No. The file is read locally with the browser's file API and converted in the page. Nothing is uploaded, logged or stored.

Can I choose the root element name?

Yes. If your JSON has one top-level key, that key is used automatically; otherwise the Root element field decides, and it defaults to root. Anything you type in the field wins.

How do I turn an array into repeated XML elements?

Leave Arrays on Repeated elements, the default: each array item becomes a sibling element with the array's name. Switch to Wrap each item in <item> if you prefer a wrapper element around the items.

How do I make a key an attribute instead of an element?

Prefix the key with @"@id" becomes id="…". You can switch the prefix to _, or turn attribute detection off entirely, in which case every key becomes an element.

What happens to namespaces?

Write keys as {http://example.com/doc}book and the converter declares xmlns:ns1 on the root and writes ns1:book. A bare prefix like d:book keeps the prefix and is declared against urn:d, because the original URI is not recoverable from a prefix alone. Choose None to strip namespaces entirely.

Why did some of my key names change?

They were not legal XML names — starting with a digit, containing a space or a slash, and so on. Illegal characters are replaced with _ and the count is shown under the result, so you can see exactly how many were rewritten.

Does the output include the XML declaration?

Yes by default: <?xml version="1.0" encoding="UTF-8"?> on the first line. Untick XML declaration for a bare fragment.

Can I convert XML back to JSON?

Yes — use the XML to JSON converter. The two pages use mirrored rules, so a document converted one way comes back the other way with its attributes, arrays and namespace keys intact.

Is there a file size limit?

No fixed one — the limit is your device's memory. Input above roughly 8 MB triggers a warning because browsers commonly struggle there, but the conversion is still attempted and any failure is reported instead of returning a partial result.