JSON to XML Converter

Turn JSON into well-formed, indented XML or switch modes to convert XML to JSON. Keys that start with @ become XML attributes.

XML output
Ctrl + Enter to run

Runs 100% in your browser — your data is never uploaded to our server.

Bridge JSON APIs and XML systems

Plenty of systems still speak XML: SOAP services, RSS and Atom feeds, Android resources, Office documents, banking and government interfaces. This converter maps between the two formats using a simple, predictable convention:

  • Each JSON key becomes an element: {"title": "X"} → <title>X</title>.
  • Arrays become repeated elements with the same name: {"book": [..., ...]} → two <book> elements.
  • Keys starting with @ become attributes: {"@id": "bk101"} → id="bk101".
  • A #text key holds an element’s text when it also has attributes or children.
  • null becomes an empty element like <note/>.
  • Characters such as &, < and > are escaped, and keys that are not valid XML names (e.g. starting with a digit or containing spaces) are sanitised.

XML → JSON uses the same convention in reverse, so you can round-trip data between the two formats.

How to convert

  1. Choose JSON → XML or XML → JSON.
  2. For JSON → XML, set the name of the root element (used when the JSON has several top-level keys or is an array).
  3. Copy or download the result.

Example

JSON

{"book": {"@id": "b1", "title": "Dune", "price": 9.99}}

XML

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <book id="b1">
    <title>Dune</title>
    <price>9.99</price>
  </book>
</root>

Frequently asked questions

How are JSON arrays represented in XML?

As repeated elements with the key name. A top-level array is wrapped in the root element with each entry as an <item> element.

Why does a single XML element not become an array?

XML has no way to say “this is a list of one”. Repeated elements become arrays; a single element becomes an object or value.

Are namespaces supported?

Prefixed names like soap:Body are kept as-is in both directions. Namespace URIs are not resolved.

Is my data uploaded?

No. Conversion runs in your browser.