Convert XML to JSON Online — Free
Convert XML to JSON online — translate legacy API responses, RSS feeds, SOAP payloads, or config files into modern JSON format.
Direct converter coming soon
XML support is coming. CSV ⇄ JSON is live today.
Open CSV to JSON Converter →How to convert XML to JSON
- 1
Add your XML file
Drop or select a .xml file. Files up to 50MB process locally in your browser — nothing uploaded.
- 2
Run the conversion
Your XML parses via the browser's DOMParser, element names become JSON object keys, attributes become @-prefixed keys (e.g., @id), text content becomes #text (or flattens when the element has no attributes/children), and repeated child elements collapse into arrays.
- 3
Download your JSON
One click saves the result as a .json file. Your original file stays on your device.
Why convert XML to JSON?
Modern web stacks expect JSON. Many older APIs (government data feeds, legacy enterprise services), RSS/Atom feeds, SOAP/WSDL services, OPML, SVG source, GPX route files, and Android/iOS resource files still emit or consume XML. Converting to JSON lets you handle XML data with standard JavaScript tooling, Mongo/CouchDB-style databases, or any language's JSON library.
Common XML to JSON use cases
- Converting RSS or Atom feed XML into JSON for a JavaScript-based feed reader or aggregator
- Translating SOAP API responses from a legacy enterprise system into JSON for modern REST consumers
- Parsing a GPX (GPS exchange) XML file into JSON for integration with a web map or fitness tracking tool
- Migrating Android/iOS XML resource files into JSON for a cross-platform localization workflow
What file size to expect
A 10 KB RSS feed with 20 items becomes a JSON file of 8-12 KB — similar size. XML's verbose angle brackets are offset by JSON's required quotes and commas. For attribute-heavy XML (like SVG), JSON output can be 20-30% larger because attributes get @-prefixed as object keys.
Technical notes: XML → JSON
Conversion follows a common XML-to-JSON convention: elements become objects, attributes become @-prefixed keys, text content is either the sole value (when no attributes/children) or a #text key (when mixed with attributes). Repeated sibling elements with the same name collapse into an array. XML namespaces can be preserved or stripped via a toggle. CDATA sections decode to their contained strings. XML entities (&, <, >, ", ') are unescaped during parsing. Mixed content (text interspersed with elements) is preserved but may produce verbose JSON.
Compatibility and browser support
Output JSON is parseable by every modern tool. The conversion semantics follow the BadgerFish or Parker convention (similar to what xml2js, fast-xml-parser, and many cloud APIs produce). If you need a different convention (e.g., JsonML), post-process the output.
XML vs JSON
| XML | JSON | |
|---|---|---|
| File size | Verbose | Compact |
| Quality | Hierarchical with schema support | Lossless data structure |
| Transparency | N/A | N/A |
| Browser / app support | Universal | All programming languages |
| Best for | Document markup, legacy APIs, configs | APIs, configs, structured data |
Related conversions
Frequently Asked Questions
Are attributes preserved?
Yes — as @-prefixed keys on the corresponding element's object. For example, <book id='1'>Title</book> becomes {book: {'@id': '1', '#text': 'Title'}}.
Namespaces?
Stripped by default (xmlns and xmlns:prefix removed from element and attribute names) with an option to preserve them as part of the key name.
Repeated elements?
Collapsed into arrays. Two <item> children under a parent become {item: [...]} in JSON, not two separate keys (which would overwrite).
Mixed content?
Preserved as best-effort — text interleaved with elements becomes a combination of #text and child object keys. Complex mixed content (prose with inline tags) may produce verbose JSON.
CDATA sections?
Decoded to their contained strings — the CDATA wrapper is removed, and the string becomes a regular JSON string value.
Available?
On the roadmap. Today our CSV ⇄ JSON tools handle tabular data; XML ⇄ JSON is coming soon.