Example input
<user id="7"><name>Ada</name><role>Engineer</role></user>
DataHub
Tools
XML to JSON
Local-first
Convert XML documents into readable JSON objects locally in your browser.
Convert XML documents into readable JSON objects locally in your browser.
<user id="7"><name>Ada</name><role>Engineer</role></user>{
"user": {
"@attributes": { "id": "7" },
"name": "Ada",
"role": "Engineer"
}
}There is no universal lossless XML-to-JSON mapping. Namespaces, mixed content, comments, processing instructions, and element order need separate review.
W3C XML and RFC 8259 define different data models. This page uses a documented convenience mapping and does not claim a canonical or lossless conversion.
Sources checked July 24, 2026. Standards can change; review the source pages before formal integration.
Attributes are placed in an @attributes object on the converted element.
Repeated child names become a JSON array in document order.
Text-only elements become strings; direct text beside child elements is stored in #text.
No. Comments, processing instructions, document type details, namespaces, and exact mixed-content order are not fully preserved.
The browser parser reports an error and the page does not produce JSON.