Source text
Paste text or upload a file
Result
Type is not detected yet
Statistics appear after formatting
Parses XML with lxml and turns elements, attributes, and text into a JSON object — no external XSD schema or setup needed.
The result is an object with one top-level key named after the root tag. An element's attributes land under @attributes, and its inline text goes under #text when the element also has attributes or children; a plain text-only element with no attributes becomes just a string value.
When an element has several child tags sharing the same name, they're automatically grouped into a JSON array under that name — so XML-style repeated elements are recognized correctly even without a dedicated wrapper tag.
<book id="42" available="true">
<title>Clean Code</title>
<author>Robert C. Martin</author>
</book>
{
"book": {
"@attributes": {
"id": "42",
"available": "true"
},
"title": "Clean Code",
"author": "Robert C. Martin"
}
}