1xA2ZOne Data. Any Format.
Live syncLocal-first · no data upload

Convert JSON to XML

Paste a JSON array into the Quick paste box. The tool flattens it into a table and writes XML with one tag per column. It only handles tabular data and does not rebuild a nested tree.

Runs entirely in your browser. Your data is never uploaded. Tiếng Việt

01

Spreadsheet

SheetsExcelCSVTSV
✦ Quick pasteSheets / Excel, CSV, TSV, Markdown, JSON, HTML, LaTeX, wiki…
0 rows · 0 columnsSelected cell: A1
02

Live Output

Markdowntwo-way
SyncedEdit directly; the table on the left updates itself
0 characters
Every change is processed right in your browserReady · LocalUTF-8 · by xuanhieu.org

When you need to convert JSON to XML

You reach for JSON to XML when a legacy system, a SOAP-style endpoint or an import step accepts only XML. JSON can nest many levels deep, while this tool works with rows and columns only. With Flatten nested objects (a.b.c) switched on, nested objects become columns named a.b.c and arrays become a.0, a.1. Each column then turns into one flat XML tag, so the nesting of the original JSON is gone.

How to do it

  1. Paste the JSON into the Quick paste box and press Load into table ↵, or use Import file with a .json file. This page already has flattening switched on.
  2. Check the grid: each nested key is a column named a.b.c. An unusually wide grid usually means one of your arrays is long.
  3. Open the XML tab and ⚙ Options. Set the root tag and the row tag, and turn on the header-as-tag option if you want tags named after the columns.
  4. Press Copy result or Download file to get the .xml file.

A real example

Tag names such as customer.name and order.items.0 are the paths from the source JSON, no longer nested. Order A2 has a single item, so its order.items.1 and order.items.2 tags are empty.

Input · JSON

[
  {
    "id": "A1",
    "customer": {
      "name": "Anna Reed",
      "city": "London"
    },
    "order": {
      "total": 450,
      "items": [
        "book",
        "pen"
      ]
    }
  },
  {
    "id": "A2",
    "customer": {
      "name": "Ben Cole",
      "city": "Leeds"
    },
    "order": {
      "total": 1250,
      "items": [
        "backpack"
      ]
    }
  },
  {
    "id": "A3",
    "customer": {
      "name": "Cara Lin",
      "city": "Bristol"
    },
    "order": {
      "total": 299.5,
      "items": [
        "notebook",
        "pen",
        "ruler"
      ]
    }
  }
]

Result · XML

<?xml version="1.0" encoding="UTF-8"?>
<orders>
  <order><id>A1</id><customer.name>Anna Reed</customer.name><customer.city>London</customer.city><order.total>450</order.total><order.items.0>book</order.items.0><order.items.1>pen</order.items.1><order.items.2></order.items.2></order>
  <order><id>A2</id><customer.name>Ben Cole</customer.name><customer.city>Leeds</customer.city><order.total>1250</order.total><order.items.0>backpack</order.items.0><order.items.1></order.items.1><order.items.2></order.items.2></order>
  <order><id>A3</id><customer.name>Cara Lin</customer.name><customer.city>Bristol</customer.city><order.total>299.5</order.total><order.items.0>notebook</order.items.0><order.items.1>pen</order.items.1><order.items.2>ruler</order.items.2></order>
</orders>

Options worth changing

Flatten nested objects (a.b.c)
Turn it on when your JSON has objects or arrays inside records. Off, the nested part sits in one cell as JSON text and is then escaped as plain text in the XML.
Root tag name
Name the element that wraps the whole set, for example orders. Characters that are invalid in a tag name are replaced with _.
Row tag name
Name the element for each record, for example order. A singular form of the root name reads best.
Use headers as tag names
On, each column becomes a tag named after its key. Off, the tool writes a generic cell tag and keeps the header as a row.

Common problems

Limits

Frequently asked questions

Does nested JSON become nested XML?

No. It is flattened into a.b.c columns and written as sibling tags. To keep a tree you need to edit the XML afterwards.

What happens to arrays?

Each element becomes its own column numbered from 0, such as order.items.0 and order.items.1, and the XML tags carry those names.

Can I add the xml declaration line?

Yes. Toggle <?xml?> declaration in the XML tab options.

What if I leave flattening off?

The nested part stays in one cell as JSON text and is escaped in the XML. Nothing is lost, but it is awkward to use.

Does my data leave the computer?

No. Reading the JSON and building the XML both happen in your browser.

Related conversions

1xA2Z · Guide

Table statistics