Developer Tools

JSON to XML Converter

Convert JSON to XML online for free: paste JSON or upload a .json file and get well-formed XML with configurable root and item names, @attribute and #text support, null handling, and exact JSON error positions. 100% in your browser, no signup.

Your XML will appear here.

⚡ This converter turns JSON into well-formed XML: objects become elements, arrays repeat the item element, @keys become attributes, #text becomes element text, and nulls follow the mode you pick. Invalid keys are repaired automatically and listed below, and text is escaped so the output is always valid XML. Everything runs locally in your browser.

🔒 Privacy: conversion runs locally in your browser. Your JSON is never uploaded, stored or seen by anyone else.

More developer tools

How this calculator works

A JSON to XML converter turns the data format most APIs speak into the format most config files, feeds and legacy systems still expect. JSON is compact and easy for code to read, but XML is what sitemaps, RSS feeds, SOAP services, Office documents and many enterprise imports require, and converting by hand means retyping every nested object and array while keeping the tags matched. Paste your JSON here, or upload a .json file, and the well-formed XML appears instantly, with live counts of elements, attributes and nesting depth and a one-click copy or .xml download.

The conversion follows the mapping most XML tools already use, so the output is predictable and easy to read back. Every object becomes an element, every array repeats one element per entry, and numbers and booleans become plain text inside their elements. Keys that start with @ become attributes instead of elements, and a #text key becomes the text content of its element, which is the same convention the XML Formatter on this site uses when it converts XML back to JSON, so data converted here converts back cleanly there. Three options cover the choices that change the shape of the output: the root element name (root by default), the element name used for array entries (item by default), and how null values are handled, as an empty element, omitted entirely, or marked with xsi:nil. The XML declaration and the indentation (2 spaces, 4 spaces or a tab) are toggles too.

Two details keep the output safe to use anywhere. First, every piece of text is escaped, so a value like Tom & Jerry <Tales> becomes Tom &amp; Jerry &lt;Tales&gt; and the document stays well-formed no matter what characters your data contains. Second, keys that are not valid XML names, such as one that starts with a digit or contains spaces, are repaired automatically (2nd place becomes _2nd_place) and the tool tells you exactly which keys it changed, instead of failing or silently dropping them. If your JSON has a mistake, the validator reports the exact line and column, so a missing comma is a one-minute fix instead of a hunt. Your JSON never leaves your device, and the result is ready to paste into a config file, a feed or an API request.

Frequently asked questions

How do I convert JSON to XML online?
Paste your JSON into the input box, or upload a .json file. The XML appears instantly, with live counts of elements, attributes and nesting depth. Copy the result or download it as data.xml. Nothing is uploaded: conversion runs in your browser.
How are arrays converted to XML?
Each entry in an array becomes its own element using the item element name, which is "item" by default and can be changed. For example, a "book" array with two entries becomes two <item> elements; set the item name to "book" and you get two <book> elements instead, which matches how most APIs expect repeated elements.
How do I make JSON keys into XML attributes?
Start a key with @ and its value becomes an attribute of the enclosing element instead of a child element. For example, {"book": {"@id": "bk101", "title": "Guide"}} becomes <book id="bk101"><title>Guide</title></book>. A #text key becomes the text content of its element, so {"note": {"@lang": "en", "#text": "Hello"}} becomes <note lang="en">Hello</note>.
What happens to null values in JSON?
You choose: empty element (<discount/>), omit the element entirely, or xsi:nil (<discount xsi:nil="true"/> with the xmlns:xsi namespace added to the root). Empty element is the default, because it keeps the key visible in the output. Pick omit when a missing element is cleaner for the system receiving the file.
What if my JSON has a key that is not a valid XML name?
The converter repairs it instead of failing: a key starting with a digit gets an underscore prefix, spaces and other illegal characters become underscores, and an empty result becomes "element". Every repair is listed as a warning under the output, so you can see exactly which keys changed before you use the file.
How do I find the error in my JSON?
Paste your JSON and the tool validates it live. When something is wrong it shows the exact line and column of the first error, such as a missing comma, an unclosed quote or a trailing comma, so you can fix it in seconds. The error position comes from a full scan of your document, not a guess.
Disclaimer: Results are estimates for planning purposes only and are not financial advice. Actual loan terms, taxes and investment returns vary. Consult a qualified professional before making financial decisions.