JSON Tools
XML to JSON Converter
Parse XML documents into JSON using the browser's built-in XML parser.
Loading tool…
What is XML → JSON?
The XML to JSON converter uses the browser's native DOMParser to parse XML and recursively convert elements into a JSON tree structure.
How it works
The browser's DOMParser handles the XML parsing. We then recursively walk the DOM, converting elements to JSON objects, attributes to @-prefixed keys, and text content to primitive values.
- Paste XML. Drop or paste well-formed XML.
- Convert. Conversion happens automatically.
- Copy or download. Copy the JSON or download as .json.
Examples
Simple element
<root><name>Alice</name></root> becomes {"name":"Alice"}.
Common mistakes
Malformed XML
The DOMParser requires well-formed XML. Unclosed tags or mismatched elements cause parse errors.
Alternatives
JSON to XML
Convert JSON back to XML.
Frequently asked questions
How are attributes handled?
Attributes are prefixed with @ (e.g., @id). Mixed content elements are not supported.