How to use JSON to XML
- 1
Paste the JSON
An object, an array of records or an API response; a .json file can be dropped instead.
- 2
Name the elements
Leave the root empty to take it from the data, and set the element name used for the items of plain arrays.
- 3
Download the XML
Indented with spaces or tabs, or on one line, with or without the <?xml?> declaration.
Limits and Pro
JSON files up to 500 MB; pasted text of any size your browser can hold.
JSON files up to 4 GB. See Pro
About JSON to XML
JSON to XML writes JSON data as an XML document for systems that still exchange XML: accounting and ERP imports, e-invoicing schemas, SOAP services, Android resources and many legacy integrations.
Every key becomes an element and every array repeats its element, so {"book": [{…}, {…}]} turns into two <book> elements side by side — the shape XML schemas usually expect. A top-level array, which XML can't have, is wrapped in a root element with one item element per entry, and a single top-level key holding an array, such as {"orders": […]}, becomes the root with singular <order> children. If the object has exactly one top-level key, that key is the root; otherwise the root is called root, or whatever name you type.
Keys starting with @ become attributes and a "#text" key becomes the element's text, the same convention the XML to JSON direction uses, so data can travel both ways. Turn on "Write simple values as attributes" for compact records such as <user id="1" name="Ann"/>.
JSON allows key names XML doesn't, so names are repaired: spaces and other invalid characters become underscores and a name starting with a digit gets an underscore in front ("1st place" → _1st_place). Text is escaped (&, < and > in content; quotes in attributes), characters XML forbids are removed, null becomes an empty element, and nested arrays get item children.
The output is UTF-8. It is well-formed XML; it isn't checked against an XSD schema, so element order and required fields are still up to your data.
Privacy
The JSON you paste or drop is read and turned into XML by a worker in this browser tab; it isn't sent to a server or saved anywhere.