Runs in your browser · Last updated 4 September 2026
XML to JSON Converter
Convert XML to JSON locally. Attributes become @keys, text becomes #text. Nothing leaves the tab.
{
"catalog": {
"book": {
"@id": "1",
"title": "Dune",
"tags": {
"tag": [
"sf",
"desert"
]
}
}
}
}How to use this tool
- Paste XML with a single root element.
- Copy the JSON object.
- If you need a spreadsheet, send arrays of objects to JSON to CSV.
Worked example
The sample catalog has one book with id=1 and two tags. The JSON has @id and a tag array. That shape is boring on purpose so API dumps stay recognizable.
Frequently asked questions
- How are attributes represented?
- As keys prefixed with @, so id="1" becomes "@id": "1".
- What about repeated child elements?
- They become a JSON array. A single child stays an object.
- Where does text go?
- If the element also has children or attributes, text is stored as #text. If it is a leaf, the value is the text string itself.
- Do you upload the XML?
- No. Parsing is local.
- Can I pretty-print first?
- Use the XML formatter, then convert.