JSON to XML

Convert JSON to XML documents.

About the JSON to XML

Turns a JSON document into indented XML. A key written with an @_ prefix becomes an attribute on its element rather than a child, an array becomes repeated sibling elements sharing the key's name, and characters like < and & are escaped to entities. Useful when a SOAP endpoint or a legacy config format wants XML and what you have is JSON. Nothing is uploaded.

How to use the JSON to XML

  1. Paste your JSON into the JSON panel, or press Sample to load an example.
  2. Pick 2 spaces or 4 spaces from the Indent selector.
  3. Press Convert to produce the XML.
  4. Copy the result, or Download it as converted.xml.

Frequently asked questions

How do I produce an attribute instead of a child element?
Prefix the key with @_. The JSON { "user": { "@_id": "1", "name": "Ada" } } becomes <user id="1"><name>Ada</name></user>. Every key without that prefix becomes an element.
Why does my output have more than one root element?
Because your JSON has more than one top-level key, and each one becomes a top-level element. XML allows only a single root, so wrap the object in one outer key before converting.
Can I convert a top-level JSON array?
Not directly. A bare array has no key to name its items, so their indexes are used as tag names — and XML names cannot begin with a digit, so the result is not well-formed. Wrap the array in an object first and that key names every item.
What happens to characters like < and &?
They are escaped to &lt; and &amp; so the output stays well-formed. You do not need to pre-escape anything in your JSON strings.
Is my JSON sent to a server?
No. The conversion runs in your browser tab; this page has no backend, so no request carries your data anywhere.

Related tools