🔒 Runs in your browser — nothing is uploaded✓ Free, no signup

JSON to XML Converter

Turn JSON into well-formed, indented XML. Arrays become repeated elements, keys starting with @_ become attributes, and a root element is added when needed.

Loading...

0 characters

XML

Loading...

When should you use the JSON to XML Converter?

  • Sending data to an XML or SOAP API from a JSON source
  • Creating XML config or feed files from JSON data
  • Converting API responses for systems that only accept XML

How to use the JSON to XML Converter

  1. 1

    Paste JSON

    Paste an object or array into the left editor.

  2. 2

    Name the root

    XML needs one root element. If your JSON has several top-level keys or is an array, it's wrapped in the root name you choose.

  3. 3

    Add attributes

    Keys that start with @_ become attributes, e.g. "@_id": 1 becomes id="1".

  4. 4

    Copy or download

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

Examples

Array of objects with attributes

JSON

{
  "catalog": {
    "book": [
      { "@_id": "1", "title": "A" },
      { "@_id": "2", "title": "B" }
    ]
  }
}

XML

<catalog>
  <book id="1">
    <title>A</title>
  </book>
  <book id="2">
    <title>B</title>
  </book>
</catalog>

Common errors and how to fix them

Invalid JSON
Fix the JSON first — the JSON Validator shows the exact line and column of the error.
Element names look wrong
XML element names can't start with a number or contain spaces. Rename keys like "1st item" to something like firstItem.
Related tools: XML to JSON Converter · XML Formatter · JSON Validator

More from JSON Tools

Free tools that run in your browser — no signup, nothing uploaded.

JSON to XML Converter FAQ

Prefix the key with @_ — for example { "book": { "@_id": "1" } } becomes <book id="1"/>. Keys without the prefix become child elements.

Each array item becomes a repeated element with the array's key as its name. A top-level array is wrapped as <root><item>…</item></root>.

XML allows only one top-level element. If your JSON has several top-level keys, or is an array or single value, it's wrapped in the root name you set.

Yes. Characters like &, < and > in values are escaped so the XML stays valid.

Empty values become self-closing elements like <note/>.

No. Conversion runs entirely in your browser.