JSON to XML
Convert JSON into well-formed XML, turning @-prefixed keys back into attributes.
About this tool
Plenty of systems still speak nothing but XML. A partner endpoint written in 2009 accepts a SOAP
envelope and rejects anything else. A payment gateway wants its request body wrapped in namespaced
elements. Search engines read sitemaps, podcast directories read RSS items, and both are XML by
specification. Everything on your side, meanwhile, is JSON: the service you already wrote, the
config your CLI prints, the fixture your test suite generates. This JSON to XML converter sits
between the two, so you can paste a payload and get a well-formed document to drop into a request
body or a file on disk. The mapping follows a small set of rules. A key prefixed with an at sign
becomes an attribute on its parent element rather than a child tag. An array becomes repeated
sibling elements sharing the same tag name. If the object has exactly one top-level key, that key
becomes the root element; if it has several, the result is wrapped in a
<root> element so the document stays valid. Output always begins with an XML
declaration, and you can pick two spaces, four spaces or tabs for indentation.
All of that happens in your browser. Nothing you paste is uploaded, logged or stored, which is the practical difference between this and the converters that post your text to a backend before answering. JSON payloads tend to carry exactly what you would least like to leak — an access token from a captured request, a row of customer data, the internal hostnames in a deploy config — and the safest way to handle that is to never send it anywhere. You can verify the claim yourself: open the page, disconnect, and keep converting. Speed follows from the same design. There is no upload, no queue and no round trip, so conversion finishes in the time it takes to parse the text, and changing the indentation re-renders the result immediately. The page is small enough to leave open in a background tab for the length of a debugging session.
Frequently asked questions
Is my JSON uploaded to a server?
No. The JSON is parsed and rebuilt as XML by a script already on the page, so the text never leaves your machine. Load the page once, cut the network, and it keeps converting. That matters when the payload is a captured API response holding bearer tokens, internal hostnames or customer records.
How do I make a JSON key become an XML attribute?
Prefix the key with an at sign. A key such as "@id": "1" is written as id="1" on the parent element instead of a child tag. Every other key becomes a child element, apart from #text, which supplies the element's own text content. This is the convention the XML to JSON tool emits, so a round trip puts the attributes back where they started.
What element name does the output use as its root?
If the JSON object has exactly one top-level key, that key becomes the root element and its value fills the document. With two or more top-level keys there is no single candidate, so the converter wraps everything in a single element named root to keep the result well formed. Rename it afterwards if the consumer expects something else.
How are arrays, numbers and null converted?
An array becomes repeated sibling elements that share the key as their tag name, which is how XML has always expressed a list. Numbers and booleans are written as their text form, since XML has no types. A null value becomes an empty self-closing tag, and characters like the ampersand are escaped.