XML to JSON converter
Convert an XML document to JSON, or a JSON structure back to XML. Attributes are kept separate from element text instead of being merged, repeated elements become arrays, and the output is pretty-printed so you can actually read it.
Parsing uses the browser's DOMParser, so malformed XML is reported with the same error the platform produces rather than a vague failure. Conversion is symmetrical for the common case: an object with a value key and an attributes key round-trips back to the same element.
Runs entirely in this tab. Nothing you paste is uploaded, logged or stored — close the page and it is gone.
Questions about this tool
How are attributes represented?
As a separate attributes object alongside the element's text and children. Merging them into one flat object would lose the distinction and cannot represent an attribute and child element with the same name.
Do single-element children become arrays?
Only when the same element name appears more than once as a sibling. A single child stays a single value, which matches what most consumers expect.
Is the conversion lossless?
For ordinary documents, yes. Comments, processing instructions and the distinction between an empty element and one containing an empty string are not preserved.
AI alternatives from the directory
Browse coding tools →This utility handles the job by hand. These do it with a model — worth a look when the task outgrows copy and paste.
The AI-first code editor
Built on VS Code, Cursor offers codebase-aware chat, multi-file edits and fast autocomplete for real engineering work.
Open-source agent inside VS Code
Cline drives your editor like a colleague: it reads files, runs terminal commands and asks for approval at each risky