SmartQueryTools

Convert JSON to XML Online

Convert JSON files to XML directly in your browser. Download a structured XML document with one element per row — no upload required.

About converting JSON to XML

JSON to XML comes up when data from a modern API has to feed an older system: an ERP import, a SOAP-era integration, an XSLT report, or a partner that only accepts XML files. This converter produces a simple, predictable layout. The root element is <data>, each JSON record becomes a <row>, and each key becomes a child element holding the value as text.

Element names must be valid XML, so keys are cleaned. Any character other than letters, digits and underscores becomes an underscore, and a name that starts with a digit gets an underscore in front. A key like created-at therefore becomes <created_at>, and 2fa_enabled becomes <_2fa_enabled>. Check that the receiving system expects those names, or rename keys first with Rename Columns.

The layout carries no types. Numbers, booleans and dates all become text, and null becomes an empty element such as <assignee></assignee>, which a reader cannot tell apart from an empty string. Nested JSON does not become nested XML: an object or array is written as escaped JSON text inside one element. Flatten nested objects before converting if the receiver expects child elements.

Worked example

A small sample file, converted with the default settings.

Input (JSON)

[
  {
    "id": 4101,
    "title": "Login fails on Safari 17",
    "state": "open",
    "comments": 3,
    "created": "2026-03-02",
    "assignee": "maria"
  },
  {
    "id": 4102,
    "title": "Export slow, then times out",
    "state": "closed",
    "comments": 8,
    "created": "2026-03-03",
    "assignee": null
  },
  {
    "id": 4103,
    "title": "Add dark mode",
    "state": "open",
    "comments": 12,
    "created": "2026-03-05",
    "assignee": "dev-team"
  },
  {
    "id": 4104,
    "title": "Crash on empty file",
    "state": "closed",
    "comments": 0,
    "created": "2026-03-06",
    "assignee": "li.wei"
  }
]

Output (XML)

<?xml version="1.0" encoding="UTF-8"?>
<data>
  <row>
    <id>4101</id>
    <title>Login fails on Safari 17</title>
    <state>open</state>
    <comments>3</comments>
    <created>2026-03-02</created>
    <assignee>maria</assignee>
  </row>
  <row>
    <id>4102</id>
    <title>Export slow, then times out</title>
    <state>closed</state>
    <comments>8</comments>
    <created>2026-03-03</created>
    <assignee></assignee>
  </row>
  <row>
    <id>4103</id>
    <title>Add dark mode</title>
    <state>open</state>
    <comments>12</comments>
    <created>2026-03-05</created>
    <assignee>dev-team</assignee>
  </row>
  <row>
    <id>4104</id>
    <title>Crash on empty file</title>
    <state>closed</state>
    <comments>0</comments>
    <created>2026-03-06</created>
    <assignee>li.wei</assignee>
  </row>
</data>

What changes when you convert JSON to XML

  • The output starts with an XML declaration, then a <data> root with one <row> per JSON record.
  • Each key becomes a child element in column order: <id>4101</id>, then <title>, <state> and so on.
  • The characters &, <, >, double quotes and apostrophes in values are escaped as entities.
  • null becomes an empty element. Issue 4102 has <assignee></assignee>.
  • Hyphens, dots and other invalid characters in key names are replaced with underscores.
  • Nested objects and arrays are written as JSON text inside the element, not as child elements.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Frequently Asked Questions

Can I change the <data> and <row> element names?

Not in the converter; both names are fixed. They are unique strings in the output, so a find-and-replace in any text editor renames them safely, or an XSLT transform can reshape the document for a specific schema.

Why did nested JSON not become nested XML elements?

The converter writes one level of elements per row and turns each value into text. Nested objects therefore appear as JSON text inside the element. Run Flatten JSON first; address.city then becomes its own <address_city> element.

Does the output include attributes, namespaces or a schema?

No. Every value is element text, there is no namespace declaration, and no XSD is generated. Because every <row> has the same children in the same order, writing an XSD for the output by hand is straightforward.

Related Tools