XML to JSON Converter
Convert XML data to JSON. Turn legacy XML API responses, SOAP payloads, or RSS/Atom feeds into JSON — attributes go under @attributes, text under #text, repeated elements become arrays — right in your browser.
Usage tips
- Elements with attributes are grouped into an `@attributes` object, kept separate from the element's own text or child elements.
- When an element mixes attributes with child elements or text, the text portion is stored under `#text` so it's never confused with an attribute value.
- Sibling elements sharing the same name are automatically collected into an array — three `
- ` tags become a 3-element array, while a single one stays a plain object.
- An empty element with no attributes, text, or children (e.g. `
`) converts to `null`. - Namespace prefixes like `xmlns` are not split apart — an element stays keyed as `ns:tag`, prefix and all.
Frequently asked questions
Side Note — Why there's no single "correct" way to turn XML into JSON
Unlike the simple row-to-object mapping between CSV and JSON, there's no single universally agreed-upon convention for converting between XML and JSON. XML lets attributes, text nodes, and child elements coexist within one element, while JSON only has plain key-value pairs — so some convention has to be chosen at conversion time. Major implementations like xml2json, xml-js, and org.json have each settled on different rules for how to represent attributes and how to handle text that coexists with child elements.
Even so, developers still run into XML plenty. SOAP-based web APIs, decades-old system integrations in finance, government, and healthcare, RSS/Atom feeds, and Android layout files are just a few of the areas where XML remains the standard format today. There's a persistent need to take data pulled from these legacy systems and feed it into a modern, JSON-only toolchain — processing it with jq, or manipulating it as a plain object in JavaScript.
The `@attributes`/`#text` convention this tool uses is a common, practical choice rather than a fully symbol-heavy notation. Leaf elements with no attributes convert straight to their text value, which keeps simple config values or an RSS title readable as plain JSON, while elements that do carry attributes are explicitly separated out — so glancing at the converted result tells you exactly which values were originally attributes.