XML → JSON
Convert XML documents to JSON, attributes included.
Attributes become @name keys; repeated siblings become arrays; text-only elements collapse to strings.
About the XML → JSON
Convert an XML document into JSON using predictable conventions: attributes become @name keys, repeated sibling elements become arrays, and text-only elements collapse into plain strings. A sample document loads by default so you can see the mapping before pasting your own data.
How to use the XML → JSON
- Paste your XML into the editor, replacing the sample book document.
- Read the JSON output as it appears once the XML parses cleanly.
- Fix the reported error if the input is not well-formed XML.
- Copy the JSON for use in APIs, scripts or configuration.
XML → JSON FAQ
How are attributes converted?
Each attribute becomes a key prefixed with @, so <book id="1"> produces an id property of @id with the value 1 alongside the element's content.
What happens with repeated elements?
Siblings sharing a tag name, like several <tag> entries, are collected into a JSON array under one key, while unique children stay as plain properties.
Does mixed content survive?
Elements containing both text and child elements keep their text under a #text key next to the child properties, following the same convention as the attributes.