XML to JSON Converter
Convert XML to JSON in your browser. Native DOMParser with configurable attribute prefix, text key, and compact mode.
How to use
- 1 Paste valid XML. The browser parses it with the native DOMParser.
- 2 Choose attribute prefix (default `@`) and text key (default `#text`).
- 3 Toggle Compact to collapse leaf elements (no attrs, no children) to plain strings.
- 4 Copy or download the JSON tree.
Why use this tool
- Native DOMParser — no external XML library bundled.
- Attributes become keys prefixed with `@`. Mixed text + children stored under `#text` key.
- Repeated child tags collapse into arrays automatically.
- Pure client-side — your data stays in your browser.
Frequently asked questions
How are attributes represented?
Each attribute becomes a key prefixed with `@` (configurable). `<note to="Tove">` becomes `{"@to": "Tove"}`.
What if a tag repeats inside its parent?
Repeated children with the same tag name collapse into a JSON array.
How is mixed content handled?
Text content sits next to children under the `#text` key (configurable).
Need to go the other way?
See <a class="text-brand-600 hover:underline" href="/json-to-xml">JSON to XML</a>, or <a class="text-brand-600 hover:underline" href="/xml-formatter">XML Formatter</a> for pretty-print only. JSON output works directly with <a class="text-brand-600 hover:underline" href="/json-formatter">JSON Formatter</a>.
XML to JSON Converter is a free developer utility by Zerethon Tools. Convert XML to JSON in your browser. Native DOMParser with configurable attribute prefix, text key, and compact mode. Runs entirely in the browser — no signup, no upload.
- Category
- Developer
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
Privacy
Your data never leaves your browser unless explicitly stated. XML to JSON Converter runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
JSON Formatter
Format, validate, and minify JSON online. Free, no signup — your data never leaves your browser.
Open toolSQL Formatter
Format SQL queries online — beautify MySQL, PostgreSQL, SQLite, SQL Server, Oracle, and BigQuery.
Open toolUUID Generator
Generate UUIDs online — v1, v4, v7, and Nil. Bulk generation up to 10,000. Free, no signup.
Open toolPassword Generator
Generate strong, cryptographically random passwords. Configurable length and character sets — runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.