Free · No sign-up · Runs in your browser
Convert JSON to XML online
Paste JSON or upload a .json file and get valid, indented XML back. Nothing is uploaded — the conversion runs in this tab.
- Always free
- Nothing uploaded
- Works offline
- Pretty-printed output
- Copy or download
JSON input
XML output
Paste JSON and click Convert to see XML.
How it works
- Paste or upload your JSON into the left pane.
- Pick your options — indentation and line wrapping.
- Convert, then copy the XML or download it as a file.
Related tools
How JSON maps onto XML
The two formats describe the same shapes but disagree on almost every detail, so a conversion always involves decisions. Knowing which ones are being made for you is the difference between output you can trust and output you have to check by hand.
| In JSON | Becomes in XML | Why |
|---|---|---|
| Object | A nested element | Each key becomes a child element name. |
| Array | Repeated sibling elements | XML has no array type, so the element simply appears many times. |
| String, number, boolean | Element text | XML is untyped — everything arrives as text. |
null | An empty element | There is no null in XML; emptiness is the closest equivalent. |
| A key with a space or symbol | A sanitised element name | XML names cannot contain spaces or start with a digit. |
The lossy direction is worth stating plainly: XML does not remember types.
Convert {"active": true, "count": 7} to XML and back, and you get the
strings "true" and "7" unless something downstream knows to
coerce them.
Element names have rules JSON keys do not
JSON keys can contain anything. XML element names cannot. A name must start with a letter or underscore, and may then contain letters, digits, hyphens, underscores and full stops — but no spaces, and nothing starting with a digit.
"first name"cannot be an element name because of the space."2024"cannot start an element name because it begins with a digit."total$"cannot contain the symbol.
The converter sanitises these rather than producing XML that will not parse. If a key is unusable it is adjusted, so the output is always well-formed even when the input was not designed with XML in mind.
Why arrays are the tricky part
This is where most JSON-to-XML conversions surprise people. JSON says
{"tags": ["a", "b"]} — one key holding a list. XML has no list type,
so it becomes two <tags> elements side by side.
That has a real consequence: a one-item array and a plain value look
identical in the XML. {"tags": ["a"]} and
{"tags": "a"} both produce a single <tags>a</tags>.
If you convert back later, there is no way to know which one you started with.
When that distinction matters — and in an API contract it often does — keep the JSON as your source of truth and treat the XML as an export format rather than a round trip.
When you actually need XML
SOAP services, banking and government integrations and older ERP systems still speak XML exclusively.
Android layouts, Maven builds, .NET config and many CI systems expect XML.
RSS, Atom, sitemaps, SVG and Office file formats are all XML underneath.
XSD is more mature than JSON Schema in regulated industries where structure must be provable.
Your data does not leave the page
The conversion runs entirely in your browser. Nothing is uploaded, which matters because the JSON people convert is often a real API response containing customer records, tokens or internal identifiers. You can confirm it yourself: load the page, disconnect from the network, and the converter still works.
Frequently asked questions
How do I convert JSON to XML?
Paste or upload your JSON, and the XML appears immediately. There is no button to press and nothing to configure for a normal conversion. Copy the result or download it as a file.
Is my JSON uploaded to a server?
No. The conversion happens entirely inside your browser, so the data never leaves your device. That matters because the JSON people convert is usually a real API response containing customer records, tokens or internal identifiers.
What happens to JSON arrays in XML?
XML has no array type, so each item becomes a repeated element with the same name. The JSON {"tags": ["a", "b"]} becomes two tags elements side by side rather than one element containing a list.
Why do a one-item array and a plain value look the same?
Because in XML they are the same. Both {"tags": ["a"]} and {"tags": "a"} produce a single tags element, and nothing in the XML records which one you started from. If that distinction matters, keep the JSON as your source of truth.
What happens to null values?
A null becomes an empty element, because XML has no equivalent of null. An empty element is the closest honest representation.
Are data types preserved?
No, and this is the main thing to know about the conversion. XML is untyped — every value becomes text. A boolean true becomes the string "true" and the number 7 becomes "7". Anything reading the XML has to know to convert them back.
What if my JSON keys contain spaces or symbols?
XML element names cannot contain spaces, cannot start with a digit, and cannot include most symbols. Keys like "first name" or "2024" are sanitised into valid names so the output always parses, rather than producing XML that would fail.
Can I convert the XML back into JSON?
You can, using the XML to JSON converter, but do not expect a perfect round trip. Types are lost, and single-item arrays cannot be distinguished from plain values. Treat XML as an export format rather than a lossless mirror of your JSON.
Does it validate my JSON first?
Yes. Invalid JSON cannot be converted, so parsing errors are reported instead of producing broken output. If you need to find and fix a problem in a large document, the JSON Formatter points at the exact position.
Is there a size limit?
The practical limit is your device's memory, since everything is processed locally. Documents of a few megabytes are fine on a normal machine; very large files are slower simply because the whole document is held at once.
Does the output include an XML declaration?
Yes, the output is a well-formed XML document with a declaration at the top, so it can be saved and parsed directly without editing.
Why would I need XML instead of JSON?
Usually because something else requires it. SOAP services, banking and government integrations, Android layouts, Maven builds, RSS feeds, sitemaps and Office documents are all XML. XSD validation is also more established than JSON Schema in regulated industries.
Is this converter free?
Yes, with no sign-up, no download and no limit on how many conversions you make.
Does it work offline?
Yes, once the page has loaded. You can disconnect from the network and the converter keeps working, which is the simplest way to confirm nothing is being uploaded.