Data Converters
JSON to XML
Convert JSON to XML using one fixed, documented convention: object keys prefixed with "@_" become attributes, "#text" becomes an element's text content, and repeated array items become repeated sibling elements. JSON and XML aren't structurally equivalent, so this tool doesn't pretend otherwise — it applies one predictable rule set.
Advertisement
Advertisement
Related tools
Features
- One documented, predictable mapping — not a best-effort guess
- Attributes become "@_name" keys, text content becomes "#text" (or a plain string when an element has no attributes or children), and repeated sibling elements become a JSON array.
How to use
- Paste a JSON object into the input.
- Click Convert.
- Copy or download the resulting XML.
Example
Input
{"root":{"item":[{"@_id":"1","#text":"a"},{"@_id":"2","#text":"b"}]}}Output
<root> <item id="1">a</item> <item id="2">b</item> </root>
FAQ
- Are JSON and XML directly equivalent?
- No — XML has attributes and mixed text/element content that JSON has no native equivalent for, and JSON has no built-in way to say "this repeats as a sibling." This tool applies one fixed, documented mapping instead of pretending the two formats are interchangeable.
- What happens to a JSON object with more than one top-level key?
- It's automatically wrapped in a <root> element, since an XML document can only have one root element. If your JSON already has exactly one top-level key, that key becomes the root element directly.
Advertisement