XML ⇄ JSON Converter

Convert XML to JSON or JSON to XML, entirely in your browser.

How to use this tool

Choose a direction, paste your data on the left, and the converted result appears instantly on the right.

About this tool — the JSON convention used

There is no single universal XML-to-JSON standard, so this tool documents its own: an element with no attributes and no child elements becomes a plain string (its text). An element with attributes and/or children becomes an object, with attributes under "@attributes" and direct text under "#text". Repeated sibling tags become an array. XML parsing itself uses your browser's native, standards-compliant XML parser (DOMParser) — not a hand-built one.

100% client-side.

Frequently asked questions

How are XML attributes represented in the JSON?

Under an "@attributes" object on that element, and any direct text content under "#text". An element with no attributes and no child elements collapses to a plain string for simplicity.

Does this handle mixed content and XML namespaces?

Namespaced tag names are kept as-is (e.g. "ns:tag"). Mixed content — text interleaved between child elements, common in document-style XML like XHTML — is simplified: all direct text is concatenated into "#text", which loses exact position. This tool targets typical data/config XML, not full mixed-content documents.