XML ↔ JSON Converter 🔒 Your data never leaves your browser.

Convert XML to JSON and back, right in your browser.

Attributes become @keys · repeated tags become arrays

Ctrl+SDownload

About this tool

XML shows up in SOAP APIs, RSS/Atom feeds, Android layouts, and countless legacy enterprise systems, while JSON is the modern default. This converter bridges them: attributes become @name keys, a text node alongside attributes becomes #text, and any tag repeated under the same parent becomes a JSON array — the same convention used by popular XML-to-JSON libraries, so the output looks familiar.

Conversion runs through your browser's built-in DOMParser — no XML library is downloaded, and no data is uploaded anywhere. Going the other way, JSON keys starting with @ become attributes and arrays become repeated sibling tags, so a careful round trip preserves your structure.

Frequently asked questions

What does the @ prefix and arrays actually mean in the converted JSON?

XML attributes are turned into JSON keys prefixed with @ (so `<item id="1">` becomes `{"@id": "1"}`), and any tag that repeats under the same parent becomes a JSON array instead of overwriting itself — that's how `<item>Milk</item><item>Eggs</item>` becomes `["Milk", "Eggs"]`.

Does this tool understand XML namespaces, CDATA sections, comments, or processing instructions?

Only partially. Namespaced tags keep their raw prefix (e.g. `ns:tag`) instead of resolving the namespace URI, CDATA content is read as plain text, and comments/processing instructions are dropped entirely. This is a pragmatic converter for typical config and data files, not a full XML-spec implementation — avoid it for XML that leans on namespaces or DTDs for correctness.

If I convert XML to JSON and back to XML, will I get the exact same document?

Close, but not byte-for-byte. Element and attribute order and values round-trip correctly, but original comments, CDATA wrappers, self-closing-tag style, and exact whitespace between tags aren't preserved — the output is semantically equivalent, not a diff-identical copy.

Is my XML or JSON uploaded anywhere when I use this?

No. Parsing uses your browser's native DOMParser and JSON.parse — both run entirely on your device. Nothing you paste or drop here is sent to a server.

How do I turn a JSON array back into repeated XML tags?

Give the array's parent object a key whose value is a JSON array — e.g. `{"item": ["Milk", "Eggs"]}` — and switching to JSON → XML mode will emit one `<item>` element per array entry. Use the Root element name field if your JSON's top level is an array or has more than one key, since XML needs a single root tag.