Runs 100% in your browser — nothing is uploaded
JSON & Data Formats

JSON → XML Converter

Convert a JSON object or array into well-formed, indented XML with a custom root element.

JSON → XML Converter
Client-side

About this tool

The JSON to XML Converter takes any valid JSON object or array and produces well-formed, properly indented XML using fast-xml-parser's XMLBuilder. This is the reverse of a common integration task: many enterprise systems, SOAP endpoints, and legacy XML-based APIs require XML input, while your application data is naturally shaped as JSON.

Because XML documents require a single root element and JSON objects don't have this constraint, you can specify a custom root element name (default "root") that wraps your JSON structure. JSON object keys become XML element names, nested objects become nested elements, and arrays produce repeated sibling elements with the same tag name — the natural inverse of how XML-to-JSON conversion collapses repeated tags into arrays.

Input is parsed with JSON.parse first, so invalid JSON is caught immediately with a clear parse error before any XML generation is attempted. Indentation width (2 or 4 spaces) is configurable, and output uses fast-xml-parser's format: true option for consistent, readable structure.

All conversion happens locally in your browser — no data is sent to any server, which matters when converting internal data models or records containing sensitive fields into an XML payload for an external system.

FAQ

Why do I need to specify a root element name?
XML requires exactly one top-level element, but JSON can be an object or array without that restriction. The root element name you choose becomes the outermost wrapping tag for your entire JSON structure.
How are JSON arrays converted to XML?
Each item in a JSON array becomes a separate XML element using the same tag name as the array's key. For example, {"roles": ["admin","editor"]} becomes <roles>admin</roles><roles>editor</roles> under the parent element.
What happens if my JSON is invalid?
The tool runs JSON.parse on your input first. If it fails, you get a clear "Invalid JSON" error with the parser's message instead of any XML output — no XML is generated from malformed input.
Can I convert JSON with nested objects and arrays together?
Yes. Nested objects become nested XML elements, and arrays within them produce repeated sibling tags at that nesting level. Arbitrarily deep structures are supported.
Does this tool send my JSON data anywhere?
No. Conversion uses fast-xml-parser's XMLBuilder running entirely in your browser tab. There are no outbound network requests involved in the conversion.