Processed locally — your file never leaves your device
XML to JSON Converter
Convert XML to JSON using documented, deterministic rules — entirely in your browser.
How it works
- Paste XML, or open a .xml file.
- Your browser parses it locally with its own built-in, XXE-resistant XML parser.
- Click Convert — elements become objects, attributes become @-prefixed keys.
- Copy the result or download it; structural limitations, if any apply, are explained in the FAQ below.
Frequently asked questions
- Is my XML uploaded anywhere?
- No, and it's parsed using your browser's own built-in XML parser, which doesn't fetch external files or resolve external entities — safe even for XML from an untrusted source.
- How are elements and attributes converted?
- An element with only text becomes a plain string. Attributes become "@name" keys. An element with child elements becomes an object, one key per distinct child tag name.
- Can every XML document be converted perfectly?
- No — and we won't pretend otherwise. A repeated child tag becomes a JSON array, but a single occurrence stays a plain value rather than a 1-item array, so round-tripping can't always tell "always a list" apart from "happened once here." Mixed content (text interleaved between child elements) collapses into one #text value, losing its exact position. Comments and processing instructions are dropped. Namespace prefixes (like ns:tag) are kept literally, not resolved.
- What happens with malformed XML?
- You'll see a specific parse error instead of a best-effort, possibly-wrong result.
- Can I open a file instead of pasting?
- Yes, there's an Open file button, or you can paste text directly.