XML ↔ JSON

Convert between XML and JSON both ways, in your browser.

Runs locally in your browser
Output No signup · local processing

Paste XML or JSON to convert between them

Paste on the left and click Convert. Attributes map to @keys, repeated tags become arrays, and text becomes values — all in your browser, nothing uploaded.

Runs entirely in your browser

Convert between XML and JSON, locally

Paste XML or JSON and this tool converts it to the other format. XML maps to JSON with a clear convention: attributes become @-prefixed keys, an element's text becomes its value (or a #text field alongside children), and repeated child tags collapse into arrays. Going the other way rebuilds XML from that same shape. Choose the direction or let it auto-detect. Everything is parsed and converted in your browser using the native XML parser — nothing is uploaded to any server.

Common questions

How does XML map to JSON?

Attributes become keys prefixed with @ (e.g. @id). An element's plain text becomes its value, or a #text key when the element also has children or attributes. When a tag repeats inside a parent, those become a JSON array.

Can it convert JSON back to XML?

Yes. JSON that follows the same convention (@attributes, #text, arrays for repeated elements) is rebuilt into XML. Choose JSON → XML, or leave it on auto-detect.

Is the round trip lossless?

For most documents, yes — element structure, attributes, and text survive a round trip. Some XML details (namespaces prefixes, processing instructions, mixed text-and-element ordering) are simplified, since JSON has no direct equivalent.

What happens with invalid input?

The input is validated first. Malformed XML or invalid JSON is reported with the parser's error message instead of producing broken output.

Is my data uploaded anywhere?

No. Everything is parsed and converted in your browser tab using the native DOMParser and the built-in JSON engine. Nothing is sent to a server.