Skip to content

JSON to XML converter

JSON to XML is a table-shaped conversion: objects are flattened into columns first, then each record is serialized as a repeated XML row.

  • Converted with Table engine · nothing stored
  • Free: 5 conversions a day · 5 MB each
  • Higher limits →

From real runs

What you get — and what changes

  • Record array Kept

    The two JSON records became two repeated XML row elements under one rows root.

  • Nested object keys Changed

    Nested customer fields were emitted as elements named customer.name and customer.city.

  • Arrays Changed

    The tags array became escaped JSON text inside a tags element, not repeated child elements.

  • Null values Changed

    JSON null values were written as self-closing XML elements such as <empty/>.

  • String IDs Kept

    The id and zip strings kept their leading zeroes because JSON typed them as strings.

  • Unicode text Kept

    München, Zoë, and 東京 were readable in the XML output without entity replacement beyond XML syntax escaping.

Sample conversions

Flattened XML rows

Input
JSON record had customer.name Ada, customer.city München, tags ["priority","quoted, comma"], and zip "02134".
Output
XML wrote <customer.name>Ada</customer.name>, <customer.city>München</customer.city>, and <zip>02134</zip>.

Array escaping

Input
JSON tags array: ["priority","quoted, comma"].
Output
XML tags element contained [&quot;priority&quot;,&quot;quoted, comma&quot;], so array structure became text.

A real JSON → XML run

We converted our JSON sample (557 B) with Table engine on 2026-09-11. It took 1 ms and produced a 694 B XML file, 1.2× larger than the input. The engine raised no warnings.

Input · sample.json · 557 B

Array of 4 objects; keys: company, stage, arr, owner, close_date

Records
4
Keys
company, stage, arr, owner, close_date

Output · sample.xml · 694 B

25 elements, root <rows>

Elements
25
Root element
rows
XML declaration
no

First lines of the output

xml
<rows>
  <row>
    <company>Northwind Traders</company>
    <stage>Proposal</stage>
    <arr>48000</arr>
    <owner>R. Ayers</owner>
    <close_date>2026-10-14</close_date>
  </row>
  <row>
    <company>Contoso Ltd</company>
    <stage>Negotiation</stage>
    <arr>120000</arr>
    <owner>P. Ng</owner>
    <close_date>2026-09-30</close_date>
  </row>
  <row>
    <company>Fabrikam</company>
    <stage>Qualified</stage>
…

Options and when to change them

flattenSeparator
Use a separator accepted by your XML consumer if dots in element names are unwelcome.
arrayMode
Choose explode when fixed-length arrays should become indexed XML elements instead of JSON strings.
encoding
Use latin1 only when the JSON-like source was saved in an older single-byte encoding.
rowElement
Set this to the repeated element name expected by the receiving system, such as item or customer.

Do it yourself

Python json and ElementTree

bash
python - <<'PY'
import json, xml.etree.ElementTree as ET
data = json.load(open("input.json", encoding="utf-8"))
root = ET.Element("rows")
for record in data:
    row = ET.SubElement(root, "row")
    for key, value in record.items():
        ET.SubElement(row, key).text = "" if value is None else str(value)
ET.ElementTree(root).write("output.xml", encoding="utf-8", xml_declaration=True)
PY

This snippet does not flatten nested dictionaries or validate XML element names.

JSON to XML by API or MCP

The HTTP API and the MCP server run the exact engine this page uses (Table engine); the response carries the same warnings the web converter shows. Check support first with GET /api/v1/pairs?from=json&to=xml.

curl
curl -X POST https://filetypeconverters.com/api/v1/convert \
  -H "Authorization: Bearer $FTC_API_KEY" \
  -F "file=@input.json" -F "from=json" -F "to=xml" \
  -F 'options={"encoding":"utf-8"}' \
  --output output.xml

Options this engine accepts for JSON → XML

KeyApplies toTypeDefault
encodingReading JSONutf-8 · latin1utf-8
flattenSeparatorReading JSONstring.
arrayModeReading JSONjson · explodejson
delimiterWriting XMLstring,
newlineWriting XML ·
sheetNameWriting XMLstring
dialectWriting XMLpostgres · mysql · sqlitepostgres
tableNameWriting XMLstringdata
createTableWriting XMLbooleantrue
API reference

When this is the wrong conversion

  • Do not use this when the target requires a nested XML schema with namespaces, attributes, or ordered mixed content.
  • If the JSON arrays are the important data, JSONL or YAML may describe them more honestly than XML row text.

JSON to XML questions

Does JSON to XML preserve nested hierarchy?

Not in this tabular route. Nested JSON is flattened before XML is written, so customer.name becomes a single element name.

What happens to JSON arrays in XML?

By default they become JSON strings inside one XML element. Our tags array was escaped as text rather than expanded into repeated tags.

Can I change the XML row element?

Yes. The rowElement write option changes the repeated item name, while the rows wrapper stays the writer's top-level container.