JSON to XML Converter
Convert JSON to well-formed XML, with attributes and arrays handled.
How to use JSON to XML Converter
- Paste JSON or open a .json file.
- Set the root element name if your JSON has several top-level keys or is an array.
- Copy or download the XML.
How it works
JSON and XML do not map one-to-one, so the converter follows the most widely used convention. Objects become elements. An array repeats the element named by its key ("item": [..] gives several <item> elements); a top-level array is wrapped in the root and its entries are named <item>. Keys beginning with @ become attributes and #text is the element’s own text. null and empty strings become empty elements.
Text is escaped (&, <, >), and key names that are not legal XML names are made safe: spaces and symbols become underscores and a leading digit gets an underscore in front. If the JSON has exactly one top-level key, that key is used as the root element. The result is checked to be well-formed before it is shown.
Everything runs in your browser. The text you paste is not uploaded, logged or saved, so configuration files, API responses and customer data stay on your device.
Example
{"user":{"@id":1,"name":"Ada"}} → <user id="1"><name>Ada</name></user>.
Frequently asked questions
How are JSON arrays converted?
Each entry becomes an element with the array’s key as its name, which is how XML normally represents lists.
How do I create XML attributes?
Prefix the key with @: {"price": {"@currency": "USD", "#text": 44.95}} gives <price currency="USD">44.95</price>.
Can I convert it back?
Yes, with XML to JSON, which uses the same convention.
What happens to key names with spaces?
They are not allowed in XML, so first name becomes first_name.
Limitations
- Data types are not recorded: numbers and booleans become text, as XML has no types.
- Namespaces are not added automatically (write them as @xmlns attributes).
- No XML schema is generated.
Last reviewed November 9, 2026. How we build and test tools.