BYTETOOLS

JSON to XML Converter

Convert JSON to readable, indented XML online. Configurable root element, arrays become repeated <item> elements, with copy and download — 100% in-browser.

Drop a .json file here or click to browse
  • Configurable root element name
  • Arrays become repeated <item> elements
  • Text content is XML-escaped automatically
  • Invalid key names sanitised into valid element names
  • 2-space, 4-space or tab indentation
  • 100% private — no upload, no server

How to use the JSON to XML Converter

  1. 1

    Paste your JSON, or drop a .json file to load it.

  2. 2

    Enter a root element name (defaults to 'root').

  3. 3

    Choose the indentation — 2 spaces, 4 spaces or a tab.

  4. 4

    Click Convert to XML to generate indented, well-formed XML.

  5. 5

    Copy the XML or download it as a .xml file.

About the JSON to XML Converter

The ByteTools JSON to XML Converter turns any JSON object or array into clean, indented XML. You choose the root element name and indentation, and the tool maps object keys to elements, arrays to repeated <item> elements, and primitive values to escaped text content.

The conversion happens entirely in your browser with JavaScript — your JSON is never uploaded anywhere. That makes it safe for configuration data, API payloads and other content you would rather keep private while producing well-formed XML.

It suits developers integrating with SOAP or legacy XML APIs, anyone generating config or feed files, and users who simply prefer XML's structure. Special characters such as ampersands and angle brackets are escaped automatically, and invalid element names are sanitised so the output stays well-formed.

Frequently asked questions

How are JSON arrays converted to XML?

Each element of an array is written as a repeated <item> element inside its parent. For example, a list of tags becomes several <item> elements, which keeps the XML well-formed since element names cannot be numeric indexes.

Can I set a custom root element name?

Yes. Type any name into the Root element field and the whole document is wrapped in that element. If you leave it blank the tool uses 'root', and any invalid characters are replaced so the result is always valid XML.

What happens to special characters like & and <?

They are escaped to their XML entities — & becomes &amp;, < becomes &lt; and > becomes &gt; — so the output is always well-formed and can be parsed by any standards-compliant XML reader.

Does the tool add an XML declaration?

Yes. The output starts with a standard <?xml version="1.0" encoding="UTF-8"?> declaration so the document is ready to save or send to XML-based systems.

Is my JSON uploaded to convert it?

No. Everything runs locally in your browser with JavaScript, so your data never leaves your device and is not stored or logged.

Related tools