JSON to XML Converter
Free online json to xml converter for developers. Convert JSON documents to XML. Fast and private.
Embed this tool
Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.
<iframe src="https://www.theutilbox.org/embed/json-to-xml" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free JSON to XML Converter tool from The Util Box"></iframe> <!-- Free tool by The Util Box — https://www.theutilbox.org/tools/json-to-xml --> <a href="https://www.theutilbox.org/tools/json-to-xml">JSON to XML Converter by The Util Box</a>
Frequently Asked Questions about JSON to XML Converter
JSON to XML Converter — With a Root Element You Choose
This JSON to XML converter turns a JSON document into XML. Paste your JSON, set the name of the root element, and you get well-formed XML with an XML declaration at the top.
The mapping is the obvious one: an object becomes an element, a key becomes a child element name, and an array
becomes the same element repeated once per item. Text values are wrapped in CDATA sections so that characters like
< and & cannot break the document.
How Each JSON Type Is Mapped
| JSON | XML |
|---|---|
| {"name":"Ada"} | <name><![CDATA[Ada]]></name> |
| {"age":36} | <age>36</age> |
| {"note":null} | <note/> |
| {"tags":["a","b"]} | <tags><![CDATA[a]]></tags> <tags><![CDATA[b]]></tags> |
| {"a":{"b":1}} | <a><b>1</b></a> |
The root element name matters because XML documents must have exactly one. The default is
root, but a name like catalog or
order usually reads better.
Honest Limits
- Attributes are not produced. Everything becomes an element, so there is no way to express a JSON key as an XML attribute rather than a child element.
- Arrays lose their wrapper name. The list item is repeated as a sibling element, which is valid XML but means the round trip back to JSON cannot recover the original array — the items come back as separate keys.
- Key names are used as tag names verbatim, so a key containing a space or starting with a digit produces invalid XML.
- CDATA is used for every string, which is safe but verbose; a consumer expecting plain text content will get it wrapped.
Related Developer Tools
- JSON Formatter — pretty-print your JSON before converting it.
- JSON Minifier — the opposite, for a compact payload.
- XML Formatter — indent the result properly.
- XML Validator — check the output is well formed.
- XML to JSON — the reverse conversion.
- JSON to YAML — the same source in a different format.
- JSON to CSV — for tabular data.
- JSON Path Tester — pull one value out of the structure.
The conversion runs entirely in your browser — your JSON is never uploaded.