JSON to XML Converter
Convert JSON objects and arrays into well-formed, indented XML. Customize the root element name and download the result.
Input JSON
XML Output
About JSON to XML Converter
This tool transforms a JSON object into well-formed XML. JSON keys become XML element names, string/number/boolean values become text content, arrays produce repeated elements, and nested objects become nested XML elements.
Conversion Rules
- Objects - Each key becomes a child element.
- Arrays - Each item becomes a repeated element with the array key as the tag name.
- Strings / Numbers / Booleans - Become the text content of the element.
- Null values - Produce an empty self-closing element.
- Keys with spaces or special characters - Are sanitized to valid XML tag names.
How to Use
- Paste your JSON into the input area.
- Optionally set a Root Element Name (default: "root").
- Click Convert to XML - the XML output appears below.
- Click Copy or Download XML to save the result.
How It Works
The tool recursively maps JSON structure to XML: objects become XML elements with child elements for each key, arrays become repeated sibling elements, and values become text content. Array items are wrapped in the parent key name as element tags.
Example
JSON: {"person":{"name":"Alice","age":30}}
XML: <root><person><name>Alice</name><age>30</age></person></root>
FAQ
Yes - use the "Root element" field to specify any valid XML element name for the wrapping root tag. The default is "root".
Yes, the output starts with <?xml version="1.0" encoding="UTF-8"?> as is standard for XML documents.
XML tag names must start with a letter or underscore and can only contain letters, digits, hyphens, underscores, and periods. Invalid characters are replaced with underscores automatically.
No. All conversion happens entirely in your browser. Your data never leaves your device.