XML to JSON converter
Convert XML into equivalent JSON, with attributes prefixed and repeated tags as arrays.
Related tools
XML to JSON converter
XML and JSON both describe structured data, but the tools around you rarely speak both. An old SOAP API, an RSS feed, an Android layout, a config file or a data export hands you XML; your script, your database or your frontend wants JSON. This tool converts between them with a real parser — not a regex hack — that handles the awkward parts of XML correctly: nested elements, attributes, mixed content, self-closing tags, comments, CDATA sections, the XML declaration and DOCTYPE.
The mapping follows the widely-used convention. An element's attributes become keys prefixed with @ (configurable), so <user id="7"> gives "@id": "7". Child elements nest as objects; when a tag repeats — three <item> elements in a row — they collapse into a single array, which is exactly what you want for lists. An element that has only text becomes a plain string; one that has both text and attributes keeps its text under a #text key. Entities like & and numeric references like A are decoded, and CDATA content is taken literally.
Because it is a genuine recursive-descent parser, it validates as it reads: a mismatched closing tag, an unterminated comment or stray content after the root produces a clear error with the line number, rather than silently mangling the output. Choose two- or four-space indentation for a readable result, or minify to a single line for embedding.
Everything runs locally in your browser — your data never leaves your device, which matters for XML exports that often carry records and identifiers.