Converting XML to JSON
Paste any well-formed XML and this tool converts it to JSON, preserving attributes (under an
@attributes key), repeated sibling elements as arrays, and text content. Useful when working with
legacy XML APIs or feeds in a modern JSON-based codebase. Everything runs locally in your browser.
Why attributes get their own special key
XML has a structural concept JSON doesn't: an element can carry both attributes and child content at the
same time (like <item id="1">Hello</item>). Since JSON objects don't have a native
equivalent to XML attributes, this tool nests them under a dedicated @attributes key, keeping
them clearly distinguishable from actual child elements or text content rather than mixing them together
ambiguously.
Why repeated tags become arrays automatically
When the same element name appears more than once at the same level in the XML (like multiple
<item> tags inside a list), representing each occurrence as a separate JSON object with
the same key would simply overwrite the previous one - so the tool detects repeated sibling tags and
automatically converts them into a JSON array instead, preserving every occurrence in its original order.
Why conversion stops with an error on invalid XML
Unlike HTML, which browsers parse leniently even when it's malformed, XML has strict well-formedness rules - every tag must be properly closed and correctly nested. This tool uses the browser's own strict XML parser, so unclosed tags or mismatched nesting produce a clear error rather than a silently incorrect or partial conversion.