Paste XML to convert it to pretty-printed JSON, keeping attributes and handling elements that repeat or mix text with child elements.
The converter parses the XML with the browser's built-in DOMParser and walks the resulting tree. Element attributes are kept with an @ prefix (for example @id), repeated child elements become arrays, an element containing only text becomes that text, and an element mixing text with children keeps its text under #text. Malformed XML is reported with a clear error rather than a partial conversion — the parser's own error document is checked for explicitly, because DOMParser reports bad XML by returning an error tree instead of throwing.
How are XML attributes represented in the JSON? Each attribute becomes a key prefixed with @, so an id attribute appears as @id on the element's object. Element names keep their original spelling.
What does #text mean in the output? When an element contains both text and child elements, the text cannot be the value itself, so it is stored under the #text key alongside the children.
Why did valid-looking XML produce an error? XML is strict: unclosed tags, a stray ampersand that is not written as an entity, or more than one root element all make a document malformed, and the parser rejects the whole document.