Convert JSON to XML

Turn JSON into an XML document.

XML

About this converter

Usually because something older is on the other end — a SOAP endpoint, an RSS feed, a configuration format, or a system that has always wanted XML and is not going to stop.

XML needs exactly one root element and JSON has no such rule, so a list or an object with several top-level keys gets wrapped in a <root> element rather than refused. A key beginning with @_ is written as an attribute instead of a child element, which is the convention the XML-to-JSON page produces — so a document converted one way and back comes out the same shape.

The result is indented and carries an XML declaration, so it can be dropped straight into a file.

Frequently asked questions

Why did it add a <root> element?

Because XML permits exactly one top-level element and your JSON had either a list or several keys at the top. Wrapping is what you would do by hand; the alternative is refusing to convert perfectly reasonable JSON.

How do I make something an attribute rather than an element?

Prefix the key with @_ — a key of "@_id" becomes id="…" on the enclosing element. That is the same convention the XML to JSON page uses when it reads attributes, so the two pages round-trip.

What happens to a list?

Each entry becomes a repeated element with the same name, which is how XML represents a list — there is no separate array syntax. A bare list at the top level becomes repeated elements inside the wrapper.

Does what I paste get sent anywhere?

No. The conversion runs in your browser, on your own machine, which is why the result appears as you type. What you paste is not uploaded or logged.

Related tools