JSON To XML

Convert JSON into XML

Convert JSON objects and arrays into well-formed XML, with your choice of root and item element names. Keys with the attribute prefix (@_ by default) become attributes.
Try an example:

Output will appear here...

About JSON To XML

How it works

  1. The JSON is parsed and wrapped in the root element you choose.
  2. Each key becomes an element; arrays become repeated elements with the same name.
  3. Keys starting with the attribute prefix (e.g. "@_id") become attributes of their parent element.
  4. Special characters (& < >) are escaped so the XML is always well-formed.

What you need

  • Valid JSON. Keys must be valid XML names (letters, digits, - _ . and not starting with a digit).

Tips

  • Converting a top-level array? Set "item" to something meaningful like "product".

Limitations

  • XML has no number or boolean types - everything becomes text.

Runs in your browser. Everything happens in your browser - your code and data are never uploaded.

Frequently asked questions

How do I create XML attributes?+

Prefix the key with the attribute prefix, by default "@_": {"book": {"@_id": "1"}} becomes <book id="1">.