XML to JSON Converter

Drop an XML file, get JSON — attributes preserved, structure intact, ready for any modern parser or API pipeline.

Drop your XML file here

Converts to .json — stays on your device

Why convert XML to JSON?

How our converter works

Your XML is parsed by fast-xml-parser — a small, fast, well-maintained XML library. Elements become nested objects. Attributes are prefixed with `@_` (so `<user id="42">` becomes `{"@_id": 42}`). Text content inside tags with attributes becomes `#text`. Numeric attribute values are auto-typed. CDATA and comments are handled per the XML spec. The conversion runs entirely in your browser — XML containing internal configs, API responses, or customer data never leaves your device.

XML vs JSON — structural differences

Feature XML JSON
Attributes First-class (`<tag attr="x">`) Keys prefixed with `@_`
Mixed content Text + elements in one tag `#text` key plus children
Comments Preserved Stripped
Namespaces First-class (`xmlns`) Prefix-as-part-of-key
Typical use Legacy, SOAP, configs, docs Modern APIs, JS-first tools

Frequently asked questions

How are attributes represented in the JSON output?

Attributes are prefixed with `@_`. So `<user id="42" active="true">Alice</user>` becomes `{"user": {"@_id": 42, "@_active": true, "#text": "Alice"}}`. This is the fast-xml-parser convention and it round-trips cleanly.

What happens to XML comments?

They're stripped. JSON has no comment syntax. If your XML comments contain structural metadata you need to keep, extract them out-of-band before converting.

Does it handle XML namespaces?

Namespaces are preserved as part of the key name (e.g. `<ns:foo>` becomes `"ns:foo"`). For aggressive namespace stripping, you'd need to post-process the JSON.

What if my XML is an RSS or Atom feed?

Works out of the box. Items are arrays when there are multiple sibling elements with the same name — so `<item>` blocks become a JSON array under `item`, which is exactly what feed parsers expect.

Are my files uploaded?

No. The parser runs entirely in your browser. XML with internal schemas, SOAP payloads containing credentials, or customer data stays on your device.

About the XML format

XML (Extensible Markup Language) predates JSON by a decade and still powers huge swaths of the tech stack: SOAP APIs, RSS/Atom feeds, Android manifests, Office Open XML (docx/xlsx), SVG, most Java/.NET/Maven configs, and countless legacy systems. JSON is XML's successor for most use cases — simpler, smaller, typed — but the interop layer between them is constant. Converting XML to JSON is what you do when you need to consume legacy data in a modern JS/Python/Go pipeline. The main design tension is attributes: XML has first-class attributes, JSON doesn't. The convention here (via fast-xml-parser) is to prefix attribute keys with `@_`, which keeps the mapping unambiguous and reversible if you need to round-trip back to XML later.