XML to JSON Converter
Convert an XML document into JSON, using a clear, documented convention for how attributes, text content and repeated elements are represented.
Attributes become keys prefixed with @, text content becomes #text, and a repeated child tag becomes an array.
Everything you enter is processed in your browser and isn't sent to our servers.
How to use xml to json converter
- 1Paste your XML.
- 2The converted JSON appears instantly on the right.
- 3Copy the result or download it as a .json file.
About this tool
There's no single official standard for representing XML as JSON — XML has concepts (attributes, mixed content, element order) that JSON doesn't have a native equivalent for, so every converter has to make some conventions. This tool's convention: attributes become object keys prefixed with @ (so an id attribute becomes "@id"), text content becomes a "#text" key, and if a tag name repeats among siblings, it becomes a JSON array instead of overwriting the earlier value.
This makes round-tripping predictable: you always know whether something came from an attribute, text content, or a child element just by looking at the key name.
Frequently asked questions
Each attribute becomes a key prefixed with "@" — for example, `<item id="42">` becomes `{"@id": "42"}` in the resulting object, keeping attributes visually distinct from child elements.