🔄 JSON to XML / XML to JSON Converter

Convert between JSON and XML formats with pretty-print output, attribute support via @attr convention, and configurable indentation.

Last updated: November 8, 2026 · By the BoltQuickTools team

Bridging JSON and XML systems

A SOAP service or legacy feed wants XML while the rest of your code speaks JSON, or the other way round. This page converts a document in either direction. The two formats do not map cleanly, so the sections below show what is kept and what is lost.

Layout

The left panel is JSON and the right is XML. Paste into one and the conversion runs automatically, overwriting the other panel. The JSON ➜ XML and XML ➜ JSON buttons run it on demand. Above the panels, Indentation sets 2 or 4 spaces and Root element names the outer tag for JSON to XML, default root. Each panel has Sample and Copy, and Clear empties both.

JSON to XML

{"order":{"@id":"A1","customer":"Ada & Co",
 "items":[{"sku":"X","qty":2},{"sku":"Y","qty":1}],
 "note":null,"paid":true}}

becomes:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <order id="A1">
    <customer>Ada &amp; Co</customer>
    <items>
      <sku>X</sku>
      <qty>2</qty>
    </items>
    <items>
      <sku>Y</sku>
      <qty>1</qty>
    </items>
    <note />
    <paid>true</paid>
  </order>
</root>

A key starting with @ becomes an attribute, #text becomes element text, and an array becomes repeated elements with no wrapper. The root element is always added, even when your JSON already has a single top-level key.

XML to JSON

<catalog owner="me"><book id="1"><title>A</title><zip>00501</zip><price>12.50</price><ok>true</ok></book></catalog>

becomes the following. The catalog tag itself is gone, because the output starts with the root element's contents.

{
  "@owner": "me",
  "book": {
    "@id": "1",
    "title": "A",
    "zip": 501,
    "price": 12.5,
    "ok": true
  }
}

Known problems when converting

Round trips and validation

Does a round trip return the same JSON?

Often not. {"x":{"list":[1],"none":null,"zip":"007"}} comes back with list as the number 1 rather than an array, none as an empty string and zip as 7. An empty array produces no element at all.

Why is my one-item list not an array?

Only repeated sibling tags become arrays, because a single element looks the same as a plain field.

Does it check my XML?

It uses the browser's parser, so badly formed XML gives an error, such as "Unexpected closing tag: a != b" in Edge. It does not validate against a DTD or schema.

To tidy or check XML on its own, use the XML Formatter. For other format pairs there is JSON to YAML and JSON to CSV.