JSON to XML
JSON to XML converts your JSON into XML you can copy or download, without uploading your data. Choose the root tag, list-item tag and indentation; inputs can be up to 5 MB.
What is the JSON to XML?
JSON to XML is a free browser tool that turns JSON objects and values into XML elements for API requests, data imports and test fixtures. Paste your JSON, choose the output settings and convert it locally. Each object key becomes a tag, while nested objects become nested elements and lists repeat tags. You can also turn specially named keys into attributes or element text. Developers, testers and analysts use it when moving data into XML-based systems. Check the receiving system’s requirements first: there is no single universal mapping from JSON to XML.
Who it is for: Built for developers, QA testers, data analysts, integration engineers and students working with JSON and XML.
How to use the JSON to XML
- Paste valid JSON into “Your JSON”.
- Set “Root tag name”, which defaults to root, and “Tag for list items with no name”, which defaults to item.
- Choose “Indent”: 2 spaces, 4 spaces, Tabs or None (one line), then set “Add the XML declaration line at the top”.
- Leave “Turn keys that start with @ into attributes, and #text into the tag's text” on if your JSON uses that mapping.
- Tap “Convert to XML”, review the read-only “XML” box, then use “Copy XML” or “Download .xml”.
Why use it
- Keep input on your deviceConversion runs in your browser, so your JSON is not uploaded.
- Set the wrapper and list tagsChoose a root name and a tag for list items that have no name.
- Create attributes and textUse the attribute switch to map @ keys to attributes and #text to element text.
- Take the XML with youCopy the result or download an .xml file with your chosen indentation.
At a glance
- What you put in
- Pasted JSON, up to 5 MB
- What you get
- XML text to copy or download as .xml
- Limits
- 5 MB; no namespaces, CDATA sections or schema support; JSON types are lost
- Privacy
- Runs in your browser. Nothing you enter is uploaded or stored.
- Price
- Free for everyone. No subscriptions, no payments, no watermark.
- Works offline
- Yes, once the page has loaded
- Last checked
- by AK Shine
Worked example
{"book":{"title":"Dune","year":1965}}<root>
<book>
<title>Dune</title>
<year>1965</year>
</book>
</root>Use Root tag name = root and Indent = 2 spaces; turn off “Add the XML declaration line at the top” to match this output.
When to use something else
- For a system requiring namespaces, CDATA sections or schema-specific XML, use a schema-aware transformation library instead.
- For inputs above 5 MB or repeated automated conversions, use a local script or command-line pipeline.
- Do not use this conversion as a lossless backup of JSON: types are lost, and another converter may use different mapping rules.
Questions people ask
Is this JSON to XML converter free and private?
Yes, it is free, with no subscriptions. Conversion runs in your browser and nothing is uploaded; an already opened tool also works offline.
Can I convert a JSON file to a downloadable XML file?
Open your JSON file in a text editor, then paste its contents into “Your JSON”; there is no file-upload control. For input up to 5 MB, tap “Convert to XML” and then “Download .xml”.
Can I choose the root element and remove the XML declaration?
Yes. Change “Root tag name” from root to your required name, and turn off “Add the XML declaration line at the top” if you do not need it.
How are JSON arrays, nested objects and null values converted?
Nested objects become nested elements, and a named list repeats its tag: {"tag":["a","b"]} produces <tag>a</tag><tag>b</tag> inside the root. Top-level lists and lists inside lists use “Tag for list items with no name”, while null and empty lists become empty tags.
How do I turn JSON values into XML attributes?
With “Turn keys that start with @ into attributes, and #text into the tag's text” on, {"book":{"@id":7,"#text":"Dune"}} produces <book id="7">Dune</book> inside the root. Turn the switch off to treat those keys as ordinary element keys, subject to XML-name fixes.
What happens to invalid XML names and special characters?
Spaces and symbols in keys become underscores, and names starting with a digit get an underscore in front. The converter escapes &, < and > in values so they are not read as XML markup.
Why does my JSON show an error?
Invalid JSON produces an error with the line and column so you can find the problem. Check for trailing commas, comments, missing brackets and keys without double quotes, then tap “Convert to XML” again.
Does the XML preserve JSON types for conversion back?
No. The number 5 and the string "5" both become the same XML text, so the output does not preserve enough information for an exact round trip. This tool converts JSON to XML only.