JSON to XML Converter
Turn JSON into clean, valid XML — attributes from “@” keys, repeated or wrapped arrays, CDATA and your own root element. Converts as you type, entirely in your browser.
At a glance
- Keys starting with @ become attributes and #text becomes element text — the same convention as the XML to JSON converter, so data round-trips.
- Arrays can repeat the element (
<tag>a</tag><tag>b</tag>) or wrap each item (<tags><item>a</item>…</tags>), and nested arrays always produce valid XML. - Data without a single root is wrapped in a root element you can name; top-level arrays get one item element per entry.
- Keys that aren’t valid XML names are fixed (“first name” →
first_name, “2nd” →_2nd) and listed, and characters XML can’t hold are removed and reported. - Options for the XML declaration, CDATA sections, self-closing empty elements and 2-space, 4-space, tab or minified output.
- Accepts relaxed JSON (comments, trailing commas, single quotes) and points to the exact line and column of real errors. Big numbers keep every digit.
- Runs entirely in your browser — the JSON is never uploaded.
Step by step
How to convert JSON to XML
- 1
Paste the JSON
Paste JSON into the left box, open a .json file, or try the Sample.
- 2
Set the options
Open Options to choose the root and item element names, how arrays are written, CDATA and the XML declaration.
- 3
Check the result
The XML appears as you type, with notes about anything that was renamed, wrapped or removed.
- 4
Copy or download
Click Copy, or Download to save an .xml file.
Features
Everything you need, nothing you don’t
Attributes and text
Write {"price": {"@currency": "INR", "#text": "799"}} and get <price currency="INR">799</price> — exactly what most XML APIs expect.
Your array style
Repeat the element for each entry, or wrap entries in item elements — whichever the receiving system wants.
Always valid XML
Invalid names are fixed, special characters escaped, mixed content kept on one line and empty arrays handled, with a note for every change.
Round-trips
Switch to XML → JSON at any time: the result converts straight back, so you can edit data as JSON and send it as XML.
Exact numbers
IDs and amounts like 12345678901234567890 or 1.50 are written exactly as in the JSON, never rounded.
Private
API payloads and configs stay on your device. No upload, no sign-up.
How JSON maps to XML
| JSON | XML |
|---|---|
{"user": {"name": "Asha"}} | <user><name>Asha</name></user> |
{"user": {"@id": "7"}} | <user id="7"/> |
{"price": {"@currency": "INR", "#text": 799}} | <price currency="INR">799</price> |
{"list": {"tag": ["a", "b"]}} | <list><tag>a</tag><tag>b</tag></list> (or wrapped: <list><tag><item>a</item><item>b</item></tag></list>) |
{"note": null} | <note/> |
[1, 2] | <root><item>1</item><item>2</item></root> |
Good to know
XML has no data types, so numbers, booleans and null all become text: true is written as <paid>true</paid>. An empty array can’t be shown with repeated elements, so it is left out (with a note) unless you choose Wrap items.
Converting the other way? Use the XML to JSON converter. To check or tidy JSON first, try the JSON Formatter.
FAQ
Frequently asked questions
How do I convert JSON to XML?
How do I make an XML attribute from JSON?
{"book": {"@id": "42", "title": "Gitanjali"}} becomes <book id="42"><title>Gitanjali</title></book>. You can change the prefix under Options.How are JSON arrays converted?
"tag": ["a","b"] gives two <tag> elements. Choose Wrap items to get <tag><item>a</item><item>b</item></tag> instead, and set the item element’s name.Why was my data wrapped in <root>?
Can it convert invalid JSON?
Is my JSON uploaded?
Keep going
Related tools
XML to JSON Converter
Convert XML to JSON and JSON to XML online. Keeps attributes, arrays and leading zeros intact, shows exact error lines and never uploads your data.
JSON Formatter & Validator
Format, validate, minify and repair JSON online. Get the exact line and column of every error, a collapsible tree view and sorted keys — private, in-browser.
JSON to CSV Converter
Convert JSON to CSV for Excel or Google Sheets: nested objects become columns, lists are kept and big numbers stay exact. Also CSV to JSON. No upload.
CSV to JSON Converter
Convert CSV or data pasted from Excel to JSON: auto-detected delimiter, real numbers and true/false, nested objects from dotted columns. Free, no upload.
DNS Lookup
Free DNS lookup: check A, AAAA, CNAME, MX, NS, TXT, SOA and CAA records of any domain, see SPF and DMARC, and do reverse DNS for an IP address.
DNS Propagation Checker
Check DNS propagation worldwide: see the A, CNAME, MX, NS or TXT answer from 7 public DNS networks and 18 ISPs in 15 countries, and track the change.
Last updated Report a problem or suggest a feature