Convert XML to JSON with attribute handling and array detection
An XML to JSON converter transforms XML markup into the equivalent JSON structure, so data trapped in an XML feed, configuration file or API response becomes something modern code can work with directly. XML and JSON both represent hierarchical data, but JSON is what JavaScript and most current tools expect, while XML is common in legacy systems, RSS feeds, SOAP services and many document formats. Converting bridges the two so you do not have to parse XML by hand.
The interesting part is that XML has features JSON does not, so the conversion has to make consistent choices: XML attributes (like id="5" inside a tag) are typically mapped to keys with a marker such as an @ prefix, repeated child elements with the same name become a JSON array, and an element's text content gets its own key. Handling these rules predictably is what makes the output usable, and getting them wrong is the main pitfall of converting by hand. This tool applies them automatically in your browser, so even private feeds and configs are never uploaded.
XML attributes have no direct JSON equivalent, so they are usually placed into keys distinguished by a prefix such as @ (for example "@id": "5"). This keeps them separate from child elements, so both the attributes and the nested content of a tag survive the conversion without colliding.
When an element contains several children with the same tag name, those become a JSON array so all of them are preserved. A single occurrence may become a plain object, which is why some converters let you force arrays consistently to avoid a shape that changes with the data.
XML separates an element's attributes, its text content and its child elements, so all three need their own place in JSON — often producing extra keys like a text node alongside attribute keys. This faithfully preserves the XML, though you may want to simplify the result for your use.
No. The conversion runs entirely in your browser, so the XML — including any private configuration, credentials or feed data — is never sent to a server. You can safely convert internal or confidential XML.
JSON Formatter · JSON Minifier · JSON Validator · JSON to CSV · JSON ↔ YAML · JSON Flatten