JSON to XML Converter
Convert JSON to well-formed XML - objects become nested elements, arrays become repeated elements, with proper escaping.
Paste JSON below - this tool converts objects to nested XML elements and arrays to repeated elements, escaping all text content properly.
More File & Data Conversion Tools
View all 20JSON keys that aren't valid XML element names (starting with a digit, containing spaces) are flagged - this tool won't silently generate broken XML.
How the Conversion Works
A JSON object's keys become XML element names wrapping their values; a JSON array's items become repeated sibling elements sharing the array's key as their element name; primitive values become the element's text content, properly escaped.
How to Use It
- Paste valid JSON.
- Optionally set a root element name.
- Click Convert.
- Copy or download the resulting XML.
Limitations
JSON has no native concept of XML attributes - this converter represents all JSON data as nested elements rather than guessing which fields you'd want as attributes, keeping the mapping predictable.
Example
{ "book": { "title": "Dune", "year": 1965, "tags": ["sci-fi", "classic"] } }
becomes:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<book>
<title>Dune</title>
<year>1965</year>
<tags>sci-fi</tags>
<tags>classic</tags>
</book>
</root>
The array becomes repeated <tags> elements, which is how XML represents lists.
When You Need XML
- Sending data to a SOAP service or an older enterprise API.
- Building sitemaps, RSS feeds or product feeds from JSON data.
- Feeding data into XSLT transformations or tools that validate against an XSD schema.
Tips
- Rename keys that start with a digit or contain spaces before converting - XML element names cannot.
- Choose a meaningful root element name; XML documents must have exactly one root.
- If a system expects some fields as attributes (
<book id="7">), adjust those by hand after converting.
Convert back with XML to JSON. Check your JSON first with the JSON Validator.
Frequently Asked Questions
Explore More Tools
Keep going with related categories and our most used tools.