Convert JSON to XML — Nested Objects, Arrays, Any Shape
Paste JSON or upload a .json file and get clean, well-formed XML in one click. Pick your root element, array item names and indent.
5 of 5 free uses left
Click the button below to convert.
Convert JSON to XML — Nested Objects, Arrays, Any Shape
Plenty of enterprise systems, SOAP APIs, RSS feeds, sitemaps, configuration files and legacy integrations still speak XML. When your code naturally produces JSON — from a REST API, a database query, or a JavaScript app — you need a clean bridge to XML that won't break on edge cases. Our JSON to XML converter handles the translation in your browser with sensible defaults and the right escaping.
The converter walks your JSON tree and maps it to XML the way you'd write it by hand. **Objects** become elements with child elements. **Arrays** become repeated sibling elements sharing the same tag (the standard XML way to represent a collection — there is no native "array" element in XML). **Primitives** (strings, numbers, booleans) become text content inside their element. **null** becomes a self-closing element (`<foo/>`). **Special characters** like `<`, `>`, `&`, `"` and `'` are properly escaped to entity references, so the output is valid XML even when your JSON values contain HTML or quotes.
You control the shape. **Root element name** lets you wrap the whole document in any tag (`<root>`, `<response>`, `<rss>`). **Array item name** sets the default tag for items inside a top-level array. **Indent** picks between minified (no whitespace, smallest payload) and pretty-printed (2 or 4 spaces, readable). **XML declaration** toggles the `<?xml version="1.0" encoding="UTF-8"?>` prolog — useful when embedding the XML inside another document.
Key names that aren't valid XML element names — anything starting with a digit, containing spaces, slashes or other invalid characters — are sanitized automatically so the output stays well-formed. Everything runs locally in your browser; your JSON never touches a server, which matters when your payload contains tokens, customer data or anything else you can't send through a third party.
How It Works
Paste or Upload JSON
Paste JSON, drop in a .json file, or fetch from a URL.
Pick Your Options
Set the root element, array item name, indent and whether to include the XML declaration.
Copy or Download
Get well-formed XML instantly. Copy to clipboard or download as data.xml.
Why Use Our Tool?
Customizable Root Element
Wrap your document in any tag you need — root, response, catalog, rss, soap-env:Envelope.
Smart Array Handling
Arrays become repeated sibling elements — the idiomatic XML way to represent collections.
Safe Entity Escaping
<, >, &, " and ' inside values are escaped to entities so the output is always valid XML.
Pretty or Minified Output
Choose 2-space, 4-space or no indent depending on whether the XML is for humans or machines.
Tag Name Sanitization
JSON keys that aren't valid XML element names are sanitized automatically to keep the output well-formed.
100% Local Processing
Conversion happens in your browser. Your JSON is never uploaded, logged or stored.