XML to JSON Converter
Paste or type XML and instantly convert it to a well-structured JSON object. The converter walks the DOM tree recursively, turning elements into object keys, repeated siblings into arrays, attributes into @-prefixed keys, and text content into string values. The result is valid, pretty-printed JSON you can copy with one click.
Edge cases are handled gracefully: mixed content (text interleaved with child elements), self-closing tags, CDATA sections, and deeply nested structures all produce sensible output. Namespaced element names are preserved as-is so nothing is silently dropped.
Everything runs in your browser using the native DOMParser API — no data leaves your machine, no server round-trip, no file-size limit beyond what your browser can hold in memory.
By The Paper Room Editorial Team — Developer Tools
Frequently asked questions
How are XML attributes handled?▼
Attributes are added to the JSON object with an @ prefix. For example, <book id="1"> becomes { "@id": "1" }. This keeps attributes visually distinct from child elements.
What happens with repeated elements?▼
When multiple sibling elements share the same tag name, they are automatically grouped into a JSON array. For example, multiple <item> tags inside a parent become an array under the "item" key.
Does it preserve CDATA sections?▼
Yes. CDATA content is treated as plain text and included in the JSON output just like regular text nodes. The CDATA wrapper is stripped since JSON doesn't need it.
Is there a size limit?▼
There is no hard limit in the tool. The practical limit is your browser's available memory. XML files up to several megabytes convert without issues on modern devices.