T

JSON ↔ XML

Elements from keys, with @_-prefixed attributes.

JSON
Loading editor…
0 B
XML
Loading editor…
0 B

JSON to XML Converter

Turns JSON structures into XML elements and parses XML back into JSON. Object keys become element names, nested objects become nested elements, and attributes are exposed with an @_ prefix so they remain distinguishable from child elements.

This is the bridge you need when a modern JSON service has to talk to a SOAP endpoint or an older enterprise integration.

How to use it

  1. Paste JSON on the left to generate XML.
  2. Press Swap to parse XML into JSON.
  3. Use the XML Formatter if you want to re-indent an XML document without converting it.

Root elements and attributes

XML requires exactly one root element. If your JSON is an array, or an object with several top-level keys, the output is wrapped in a <root> element so the result is well-formed. A single-key object is used as the root directly.

When parsing XML, attributes appear as keys prefixed with @_ and element text as #text where an element has both. That keeps the mapping lossless enough to convert back.

Frequently asked questions

Why is my output wrapped in a <root> element?

Because XML permits only one root element and your JSON had an array or several top-level keys. Wrap your JSON in a single key to control the root element's name.

How are XML attributes represented in JSON?

With an @_ prefix, so <book id="1"/> becomes {"book": {"@_id": 1}}. This keeps attributes distinct from child elements of the same name.

Is the conversion lossless both ways?

Close, but not perfectly. XML carries concepts JSON has no equivalent for — comments, processing instructions, namespace declarations and mixed content — so use the XML Formatter when you need to see a document exactly as sent.

Related tools

Everything on this page runs in your browser. TurboParse is a static site with no backend, so nothing you paste is uploaded, logged or stored.

Last updated .