How to Convert JSON to XML
How do I convert JSON to XML?
Paste your JSON into a converter, pick how arrays and the XML declaration should map, and run it. A converter that shows its mapping makes it obvious how each JSON value becomes an XML element, and large files are handled in a background worker without leaving your machine.
The three steps
Open the JSON to XML converter, paste your JSON into the left editor, or drop a .json file, then choose the options you want: pretty-print the output, include the XML declaration, and set the array item tag. Press Convert and the XML appears on the right, ready to copy or download.
How the mapping works
The converter walks your JSON and builds XML with a straightforward rule set. Every object becomes an element named after its key. Every primitive value, a string, a number, a boolean, or null, becomes the text content of its element. Arrays are the one structure that needs a decision, covered next.
- Objects become elements named after their key
- Strings, numbers, booleans, and null become element text
- Arrays become a wrapper element with repeated children
How arrays are represented
XML has no native array type, so each array becomes a wrapper element, named after the key, containing one child per entry using the array item tag you set. With the default item tag, "tags": ["a", "b"] becomes <tags><item>a</item><item>b</item></tags>.
What XML gains and loses
XML keeps the structure of your data, but it is a document format, not a typed one. It has no native null, no number versus string distinction, and no arrays. Converting is lossy at the edges: a null can become an empty element, and a number becomes text. The reverse tool, XML to JSON, is just as honest about its limits. Do not expect a byte-identical round trip.
Converting a large JSON file
Paste a huge JSON blob and the browser can choke. Drop a file instead and the converter switches to a background worker: it reads and converts off the main thread, shows a capped preview in the editor, and offers the full XML as a download. Nothing is uploaded.
Converter versus formatter
A JSON formatter pretty-prints JSON without changing the format. A converter changes the format entirely, from JSON to XML. If your goal is readable JSON, format it. If an XML consumer is waiting, convert it. Both tools run entirely in your browser.
FAQ
Can I convert JSON to XML without uploading my data?
Yes. The conversion runs entirely in your browser, so your JSON never leaves your machine. Paste or drop a file and the XML is produced locally.
Why is every array entry wrapped in an item tag?
XML has no native arrays, so each array becomes a wrapper element with one child per entry. The tag is configurable; the default is item.
Will converting lose any information?
Some. XML has no null, no number versus string distinction, and no arrays, so a few JSON types have to be represented as text. The mapping stays readable, but a round trip back to JSON is not always identical.
Can this handle a very large JSON file?
Yes. Drop a large file and the conversion runs in a background worker with a capped preview and a full download, rather than freezing the page.