Developer Tools

JSON to XML Converter

Convert JSON objects and arrays into well-formed, indented XML.

When you need XML instead of JSON

JSON is the default for modern web APIs, but XML is still required by many systems: banking and payment gateways, government e-filing portals, SOAP web services, RSS feeds, sitemaps, Android resources and older enterprise software. This converter turns JSON data into well-formed XML with proper indentation and escaping, ready to send or save.

How to convert JSON to XML

  1. Paste your JSON.
  2. Set the root element name, used when the JSON has several top-level keys or is an array, and the name for array items that have no key of their own.
  3. Click Convert to XML, then copy or download the file.

Conversion rules

JSONXML
"name": "Asha"<name>Asha</name>
"@id": "A1" (key starting with @)Attribute: <order id="A1">
"#text": "Hello"Text content of the parent element
Array of objects "items": [{…},{…}]<items><item>…</item><item>…</item></items>
Array of values "tag": ["a","b"]<tag>a</tag><tag>b</tag>
nullEmpty element <name/>

Valid names and escaping

XML element names cannot contain spaces or start with a number, so invalid characters are replaced with underscores and a leading digit gets an underscore in front: "2026 sales" becomes <_2026_sales>. The special characters &, <, > and " inside values are escaped, so "Asha & Co." stays valid XML.

Frequently asked questions

Why does XML need a single root element?

A well-formed XML document must have exactly one outer element. If your JSON has one top-level key, that key becomes the root; otherwise the root name you choose wraps everything.

Are numbers and booleans kept?

They become text, because XML has no data types without a schema. true becomes <paid>true</paid>.

Can I convert XML to JSON?

Yes, with the XML to JSON converter.