XML to JSON
JSON
XML
Empty Runs in your browser

JSON to XML Converter Online - Free & Private

Paste JSON and get indented, well-formed XML. Arrays become repeated elements, keys that start with @ become attributes, and invalid characters in names are fixed so the XML always parses.

How to convert JSON to XML

  1. Paste JSON into the left editor, or open or drop a .json file.
  2. Indented XML appears on the right with syntax highlighting.
  3. Copy the XML or download it as an .xml file.

How JSON maps to XML

JSON and XML do not describe data in quite the same way, so the converter follows a small set of rules that are widely used and easy to predict:

If the JSON has exactly one top-level key, that key becomes the root element. Otherwise everything is wrapped in a root element whose name you choose.

Options

Example

{"catalog": {"book": [{"@id": "bk101", "title": "Dune"}]}} becomes:

<catalog>
  <book id="bk101">
    <title>Dune</title>
  </book>
</catalog>

The same rules work in reverse in the XML to JSON converter, so a document survives the round trip.

Private by design

The conversion runs in your browser and your data is never uploaded.

Frequently asked questions

How do I convert JSON to XML?

Paste JSON into the left editor or open a .json file. Indented XML appears on the right. Set the root element name if you need one, then copy or download the .xml file.

How do I create XML attributes from JSON?

Start the key with @. For example {"book": {"@id": "bk101", "title": "Dune"}} becomes <book id="bk101"><title>Dune</title></book>.

How are arrays converted to XML?

An array becomes repeated elements with the same name, so {"item": [1, 2]} becomes <item>1</item><item>2</item>.

What happens to keys that are not valid XML names?

Characters that XML names cannot contain, such as spaces, are replaced with underscores, and a name that starts with a digit gets a leading underscore.

Editor settings

Type

{
  "id": 1024, "name": "Ada", "active": true,
  "tags": ["0O", "1lI", "=> != >="], "manager": null
}

Colour theme

Code editor

Defaults

Send feedback

How is online-json working for you?