Convert JSON to XML — objects become elements, arrays repeat a singularized child element, and special characters are escaped. Root element name and indentation are configurable.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
For the systems that still speak XML
SOAP endpoints, enterprise integrations, RSS-adjacent formats, legacy imports — XML is far from gone. This converter maps JSON to well-formed XML with a documented, predictable convention: objects become elements, arrays repeat a singularized child (items → <item>), null becomes null="true", and every special character is escaped. Keys that cannot be XML element names are preserved as <item name="…"> rather than mangled.
Worked example
{ "order": { "id": "ORD-2041", "items": [ { "sku": "K-88" } ] } }becomes:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<order>
<id>ORD-2041</id>
<items>
<item>
<sku>K-88</sku>
</item>
</items>
</order>
</root>Limitations to know
- There is no official JSON↔XML standard — this is a convention, stated openly. Different consumers may expect different mappings (attributes vs elements); check theirs.
- XML text is untyped: numbers and booleans become text content. Keep the JSON as the source of truth.
- Nothing becomes an attribute (JSON cannot express that intent) except the null marker.
Common errors and fixes
- Root name rejected — element names must start with a letter or underscore; the default
rootalways works. - Round trip — the XML to JSON Converter reverses this; types return via its coercion option.
How to use the JSON to XML Converter
- Paste JSON into the input panel.
- Set the root element name and whether to include the <?xml ?> declaration.
- Click "Convert to XML".
- Copy the XML — arrays repeat a singularized child element (items → item).
Frequently asked questions
How is JSON mapped to XML?
Objects become elements, keys become child elements, arrays repeat a singularized element per item, null becomes null="true", and &, < and > in text are escaped. There is no official JSON↔XML standard — this is the widely-used convention, documented so you know exactly what you get.
What happens to keys that are not valid XML names?
A key like "my key!" cannot be an element name, so it is emitted as <item name="my key!">…</item> — preserved verbatim in an attribute rather than mangled or dropped. A warning lists every such key.
Are JSON types preserved in XML?
No — XML text has no types, so 42, "42" and true all become text content. If a consumer needs types, keep the JSON as the source of truth; XML output is for systems that require XML.
Can I get attributes instead of child elements?
Not from plain JSON — nothing in JSON marks a value as "attribute-like", so guessing would be arbitrary. Values become elements; the one exception is the null="true" marker.