JSON to XML Converter

Paste JSON, get indented XML

Input (JSON)

Output (XML)

JSON to XML Converter guide

Some APIs, feeds, and enterprise systems still require XML. This converter turns a JSON object into indented XML, with each key becoming an element.

How it converts

  • Keys. Each key becomes an element, and nested objects become nested elements.
  • Arrays. Each item in an array becomes its own element with the key's name, so "tags": ["a", "b"] becomes two <tags> elements.
  • Root element. XML needs one root. Wrap your data in a single top-level key, such as { "order": { ... } }.
  • Declaration. The <?xml ?> header is not added. Put it at the top yourself if your target needs it.

Example

{ "note": { "to": "Ann", "tags": ["a", "b"] } }

// converts to

<note>
  <to>Ann</to>
  <tags>a</tags>
  <tags>b</tags>
</note>

Frequently asked questions

How do I add XML attributes?
The converter writes elements only. Add attributes to the output by hand if your target format needs them.
Why does my output have more than one root element?
Each top-level key becomes an element. Wrap everything in one key, such as { "root": { ... } }, to get a single root.
Does it add an XML declaration?
No. Add <?xml version="1.0" encoding="UTF-8"?> to the first line if you need one.