JSON to XML Converter
Convert JSON to well-formed XML. Keys become element names, arrays become repeated elements, and keys starting with @_ become attributes. Set the root element name.
How XML maps to JSON (and why shapes jump)
XML has attributes, mixed text and repeated elements; JSON has only objects, arrays and values. Every converter has to choose. Toggle each feature to see the choice.
<library> <book id="42" lang="en"><title>Dune</title></book> </library>
{
"library": {
"book": {
"title": "Dune",
"@_id": 42,
"@_lang": "en"
}
}
}- Attributes become keys with an
@_prefix so they cannot collide with child elements of the same name.
How it works
XML needs a single root, so the output is wrapped in a root element you name. Keys that are not legal XML names (starting with a digit, containing spaces) are made safe.
Special characters (&, <, >) in text are escaped.
Everything above runs in JavaScript inside this tab. Your data is not uploaded. Inputs are remembered in this browser only so they survive a reload; you can switch that off on the privacy page.
Questions
How do I create attributes?
Prefix the key with @_, for example {"book": {"@_id": "7", "title": "Dune"}} gives <book id="7"><title>Dune</title></book>.
How are arrays represented?
Each array item becomes a repeated element with the array’s key as its name.
Is my JSON sent to a server?
No. Conversion happens in your browser. The only network request is the optional AI explanation when your input has an error and you ask for it.