XML to JSON Converter
Convert XML into JSON, right in your browser. Attributes become @attr keys, text content becomes #text.
This file is processed in your browser and never uploaded to a server.
How It Works
1. Drop your file here
2. Processing…
3. Download
Features
- Preserves attributes and repeated elements
- Paste text or upload an .xml file
- Copy or download the result
Frequently Asked Questions
- How are XML attributes represented in the JSON?
- As keys prefixed with @, e.g. an id="1" attribute becomes "@id": "1".
- What happens to repeated sibling tags?
- They're combined into a JSON array under that tag's key.
- What happens to text that sits alongside child elements (mixed content)?
- It's dropped — only attributes and child elements are captured when a tag has both, so this tool suits data-style XML best rather than mixed-content documents like XHTML.
- What happens if my XML is malformed?
- An "Invalid XML" error is shown since the browser's XML parser rejects it outright; fix issues like unclosed or mismatched tags before converting.
- Are XML namespace prefixes preserved in the resulting JSON keys?
- Yes, tag names keep their namespace prefix exactly as written — e.g. <ns:item> becomes an "ns:item" key — the tool doesn't resolve or strip namespaces.
Related Tools
Add this tool to your website
Copy the code below and paste it into any page. It's free, needs no sign-up, and files are processed in your visitors' own browsers.