Convert JSON to XML Online
Serialize JSON arrays and objects to valid, well-formed XML with configurable root and item element names.
JSON → XML
Free JSON to XML converter. Convert JSON objects and arrays to well-formed XML. Handles arrays, nested objects, null values, and invalid tag name characters. Works in your browser.
Output will appear here
How to use the JSON → XML
Paste or upload your JSON data
Paste text directly into the input box, drag and drop a file onto it, or click "Upload file" to browse. Conversion starts instantly on paste — no button click required.
Configure options (optional)
Open the Options panel to customise delimiter, headers, nested-object flattening, and more. Use the Field Selector to pick exactly which columns appear in the output.
Copy or download your XML
Click Copy to grab the result, or Download to save the file. Everything runs locally in your browser — no data ever leaves your device.
Example
Input (JSON)
[
{ "id": 1, "name": "Alice" }
]Output (XML)
<root>
<item><id>1</id><name>Alice</name></item>
</root>Frequently Asked Questions
- Is my data safe?
- Yes. Every conversion runs entirely inside your browser. No data is ever transmitted to a server. The tool works offline once loaded.
- What is the maximum file size?
- There is no hard limit. Files under 1 MB convert instantly. Files 1–10 MB show a progress indicator. Files over 10 MB prompt a warning and run in a background thread to keep the browser responsive.
- Why does my JSON fail to parse?
- Common causes are trailing commas, single-quoted strings, unquoted keys, or missing closing brackets. The converter auto-repairs many of these and tells you exactly what it changed.
- Can I convert multiple files at once?
- The tool handles one file at a time. For bulk conversion, consider the csvjson CLI or API.
Related Converters
How it works
JSON keys become XML elements
Each key in a JSON object becomes a child XML element. Nested objects produce nested elements. Keys with spaces or invalid XML characters are automatically sanitised to valid tag names.
Arrays produce repeated elements
A JSON array like [{}, {}] produces repeated child elements with the same tag name. The item element name defaults to 'item' and is configurable in the options panel.
Root element is required and configurable
JSON has no root wrapper concept, but valid XML requires exactly one root element. The default is <root> — change it to match your schema: <products>, <people>, <orders>.
Example
Product catalog JSON to XML feed for a shopping integration
[
{ "id": "P001", "name": "Wireless Headphones", "price": 79.99 },
{ "id": "P002", "name": "USB-C Hub", "price": 34.99 }
]<?xml version="1.0" encoding="UTF-8"?>
<products>
<item>
<id>P001</id>
<name>Wireless Headphones</name>
<price>79.99</price>
</item>
<item>
<id>P002</id>
<name>USB-C Hub</name>
<price>34.99</price>
</item>
</products>Root element set to 'products', item element to 'item'. Both are configurable — match any XML schema your system expects.
Edge cases, handled
Invalid tag name characters
JSON keys can contain spaces, hyphens, or start with digits — all illegal in XML. Keys are automatically sanitised to valid element names before conversion.
Null values
JSON null becomes an empty XML element: <field></field>. The element is present in the document structure but has no text content.
Nested arrays of objects
Arrays of objects nested inside other objects produce correctly nested repeated elements at the right depth — not a flattened list.
Frequently asked questions
How are JSON arrays represented in XML?
Each array element becomes a repeated child element with the same tag name. [{id:1},{id:2}] with root 'products' and item 'product' produces two <product> elements inside <products>. The item element name is configurable.
What about XML attributes vs child elements?
All JSON values become child elements, not XML attributes. If you need attributes in the output, edit the raw XML after conversion — the converter produces child-element-only XML.
How are null values handled?
JSON null becomes an empty XML element — <field></field>. The element exists in the output but contains no text content, which is the closest XML equivalent to null.
My JSON key contains a space or starts with a number — what happens?
XML element names cannot start with a digit, contain spaces, or include most special characters. Keys that violate these rules are automatically sanitised: spaces become underscores, leading digits get a leading underscore, and other invalid characters are replaced.
Can I convert JSON to SOAP XML?
SOAP has a specific envelope structure (<Envelope>, <Header>, <Body>) that requires manual construction. This converter produces generic well-formed XML for the data payload. Wrap it in the SOAP envelope in your application code.
Related Tools
All conversions run in your browser — nothing is uploaded.
Browse all 26 converters →