XML to JSON Converter

Convert XML to JSON (and back) entirely in your browser. Attributes, nested elements, repeated tags and text are mapped automatically. No upload.

Convert

How it works

About XML ↔ JSON

XML and JSON represent the same tree of data with different syntax, so moving between them is mostly a question of convention: where do attributes go, and how do repeated siblings become arrays? This tool uses the widely adopted convention that attributes live under @attributes and repeated tags become arrays, which keeps the conversion predictable and reversible.

Use it to bridge an XML API response into JSON your code consumes, or to emit XML from a JSON document. For round-tripping, the JSON view is the source of truth; re-converting it to XML produces a structurally equivalent document, though attribute ordering may differ from the original.

The XML → JSON mapping

The converter parses the XML with the browser's DOM parser, then walks the resulting tree. Attributes surface as an `@attributes` object, text content as `#text`, and child elements as nested objects. When several children share a tag, they are gathered into an array so the structure round-trips predictably.

Namespaces and prefixes are preserved verbatim as tag and attribute names — the tool does not rewrite them. If your document uses default namespaces, expect the prefix to appear in the JSON keys; this keeps the mapping lossless rather than opinionated.

JSON → XML direction

In the reverse direction, each object becomes a parent element containing its properties as child elements; an array repeats the child element once per item under the array's key. Scalars become text content, and `null` is emitted as an empty element.

The root element name is taken from the top-level object's single key when there is one, or from the configurable root name otherwise. This is a structural subset mapping — it does not model XML attributes on the JSON side, CDATA sections, or processing instructions.

Privacy and limits

All parsing happens locally: the XML or JSON never leaves the page and there is no upload. Large documents take as long as the browser needs but stay on your machine.

Because the mapping is intentionally simple, very large or deeply nested XML may produce verbose JSON. Treat the output as a faithful structural translation, not a semantically typed document.

Frequently Asked Questions

How are XML attributes and repeated tags handled?
Attributes are placed under an `@attributes` object on their element. Child elements with the same tag name are collected into a JSON array; a single child stays a single object. Element text is kept under `#text` when the element also has attributes or children.
Can it convert JSON back to XML?
Yes. Switch the mode to JSON → XML and the tool serialises your JSON: objects become nested elements, arrays repeat the parent's child element, and strings/numbers/booleans become text content. Root element name is configurable.
Is my data sent to a server?
No. Every tool on jsonversal runs entirely in your browser using the Web Crypto API, File API, and Clipboard API. Nothing is ever uploaded — not even the JSON you paste in.
Do I need an account or API key?
No signup, no email, no API key. All tools are free to use with no signup required.
Can I use these tools offline?
Yes. Once the page loads, all tools work offline. There are no external API calls or CDN dependencies at runtime.
🔒
Your data never leaves your device

All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.

esc
↑↓ navigate ↵ open esc close