JSON to XML
Convert JSON to well-formed XML.
Related Tools
Convert XML to JSON, preserving attributes and namespaces.
Pretty-print XML with namespace, CDATA, and comment support.
Beautify and pretty-print JSON with configurable indentation.
Validate JSON against a JSON Schema with JSON-pointer error paths.
Convert a JSON array of objects into a spreadsheet-ready CSV file.
Convert JSON to YAML while preserving key order.
Documentation
What is JSON to XML?
This tool converts a JSON document into well-formed XML, wrapping the whole thing in a configurable root element. It's useful when a downstream system — a legacy API, an XSLT pipeline, a SOAP endpoint — expects XML but your data originates as JSON.
How it works
Each JSON key becomes an XML tag wrapping its value: objects recurse into child elements, primitive values become text content, and null/undefined become a self-closing empty tag (<field/>) rather than an empty pair of tags. Arrays are handled specially: the array's own key has its trailing "s" stripped to name each repeated child element (so a key like tags produces repeated <tag> elements, one per item) instead of wrapping the whole array in a single container element. Any key that isn't a legal XML tag name (containing spaces, starting with a digit, etc.) falls back to a generic <item> tag so the output always stays valid XML. Text content is escaped for the five XML special characters (& < > " '-equivalents) before being inserted.
Features
- Configurable root element name via the toolbar's Root field
- Arrays expand into repeated sibling elements rather than a nested list wrapper
nullvalues render as self-closing empty tags- Invalid tag-name keys automatically fall back to a generic
<item>element - Full XML entity escaping on all text content
- Runs entirely client-side — nothing you paste is uploaded
Example
Input: { "user": { "name": "Ana", "email": null }, "tags": ["dev", "admin"] } with root name root.
Output:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<user>
<name>Ana</name>
<email/>
</user>
<tag>dev</tag>
<tag>admin</tag>
</root>Common errors
The array-key singularization is a naive trailing-"s" strip, not real linguistic singularization: a key like tags becomes tag correctly, but an irregular plural like children would become childre. If that matters for your output, rename the array's key in the source JSON before converting, or edit the generated tag names afterward. Also note that top-level JSON arrays (rather than an array nested inside an object) are converted item-by-item under a generic <item> tag, since there's no parent key to derive a name from.
Best practices
Pick array key names that are already correct plain-English plurals ending in a single "s" (tags, items, users) so the generated singular element names read naturally. If the target system needs attributes rather than child elements (e.g. <user id="1"> instead of a nested <id> element), you'll need to restructure the JSON or post-process the XML, since this converter always emits child elements, never attributes.
Frequently Asked Questions
How are JSON arrays represented in XML?▾
Each array item becomes a repeated sibling element, named after the array's key with a trailing "s" stripped (e.g. tools ->
What happens to keys that aren't valid XML tag names?▾
Keys with characters XML tags don't allow (like spaces) fall back to a generic
Can I set the root element name?▾
Yes — the Root field in the toolbar controls the wrapping element name.
Is my data uploaded anywhere?▾
No — the conversion runs entirely in your browser.