Skip to main content

JSON to XML Converter

Convert JSON to XML format instantly in your browser.

Reviewed by · Last reviewed

How to Use the JSON to XML Converter

  1. Paste your JSON into the input area.
  2. Click Convert to XML.
  3. Copy the XML output with the Copy button.

What It Does

The JSON to XML Converter transforms any valid JSON object or array into well-formed XML, entirely in the browser. It pretty-prints with two-space indentation, wraps array elements in <item> tags, sanitizes key names to valid XML element names, escapes all five OWASP XML special characters (&, <, >, ", '), and handles null values as self-closing elements. Output larger than 100,000 characters is shown truncated in the preview but the full XML is available via the Copy button.

Frequently Asked Questions

How are JSON arrays converted to XML?

Each element in a JSON array is wrapped in an <code>&lt;item&gt;</code> element. For example, <code>[1, 2]</code> under a key <code>nums</code> becomes <code>&lt;nums&gt;&lt;item&gt;1&lt;/item&gt;&lt;item&gt;2&lt;/item&gt;&lt;/nums&gt;</code>.

Is my JSON sent to a server?

No. The conversion runs entirely in your browser tab using JavaScript. There is no network request and no data is uploaded anywhere.

What happens to keys with spaces or special characters?

Keys are sanitized to produce valid XML element names. Any character outside letters, digits, underscores, hyphens, and dots is replaced with an underscore. Keys starting with a digit or the letters <code>xml</code> (case-insensitive) get a leading underscore prepended.

More Developer Tools