JSON to XML Converter
Convert any JSON object to a well-formed XML document instantly. Set a custom root element, and copy or download the output as a .xml file.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<person>
<name>Alice</name>
<age>30</age>
<email>alice@example.com</email>
<hobbies>reading</hobbies>
<hobbies>coding</hobbies>
<hobbies>hiking</hobbies>
</person>
</root> How It Works
Formula
Recursive DOM serialization: each JSON key becomes an XML element Worked Example
{"person":{"name":"Alice","age":30}} converts to <root><person><name>Alice</name><age>30</age></person></root>
JSON vs. XML: When to Convert
While JSON is the dominant format for modern REST APIs, XML remains standard in:
- Enterprise integrations (SOAP web services, EDI systems)
- Document formats (XHTML, SVG, Microsoft Office XML)
- Configuration files (Maven
pom.xml, AndroidAndroidManifest.xml) - Legacy system APIs that predate JSON adoption
Converting JSON to XML allows you to bridge modern JSON-producing systems with XML-consuming integrations without writing custom serialization code.
XML Naming Conventions
XML element names must start with a letter or underscore and cannot contain spaces. The root element name you configure is automatically sanitized to remove invalid characters.
Frequently Asked Questions
How are JSON arrays converted to XML?
Each array item becomes a separate element with the array's key name as the tag. For example, 'hobbies: ["reading","coding"]' becomes <hobbies>reading</hobbies><hobbies>coding</hobbies>.
Does the converter handle nested JSON?
Yes. Nested objects and arrays are recursively converted, preserving all nesting levels in the output XML.
What happens to null values?
JSON null values are rendered as self-closing empty tags, e.g. <field/>, which is standard XML convention for absent or null values.
Does the output include an XML declaration?
Yes. The output always includes the standard <?xml version="1.0" encoding="UTF-8"?> declaration as the first line.
Related Tools
← View all json toolsJson To Excel Calculator
Paste/upload JSON array -> table preview -> download .xlsx/.csv. SheetJS (xlsx) lazy-loaded on click only; flatten nested keys with dot notation. All client-side.
Json Formatter Calculator
Format (indent 2/4/tab), minify, validate; error with line/column; tree view collapse; sort keys option; copy/download.
Json Beautifier
Paste/type JSON -> beautify with 2/4/tab indent, sort keys option, copy & download output. Full client-side validation with error highlighting.
Xml To Json Calculator
Convert XML to JSON. Handles attributes, text nodes, nested elements. Pretty-print JSON output. Copy & download.