Menu

XML to JSON Converter

Preserve XML elements, attributes and mixed content in a documented, ordered JSON tree.

Free, local conversion and download. Files stay in your browser.

Your XML

Up to 1 MiB of UTF-8 XML, 5,000 nodes/attributes and 100 nested element levels. DTD/entity declarations are not supported.
Paste one complete XML document with a single root element. Use Try an example to see repeated item elements and a quoted id attribute. Both are preserved in the output tree.

Your JSON download

Open a file or paste XML to begin.

How XML maps to JSON

Copy JSON copies the complete converted JSON tree, including content beyond the shortened preview. The free JSON download remains available if clipboard copying is unavailable. Pasted content and files are not saved between visits.

The download uses format: "xml-tree-v1" with a document children array. Element nodes contain their qualified name, namespaceURI, an attributes array (name, namespaceURI, value), and ordered children. Text, CDATA, comments and processing instructions have explicit types and values. Repeated siblings and mixed-content order stay intact. Names and numeric-looking values stay strings; no automatic type guessing occurs. Valid elements named parsererror are supported. HTML, SVG and MathML namespaces are made inert during parsing and restored as data in the JSON.

This is an explicit tree representation, not a compact object mapping or a byte-for-byte XML archive. The browser parser expands built-in/numeric character references and normalizes XML line endings; quote style, original entity spelling and the XML declaration are not retained. The preview may be shortened; the download contains the full supported tree. Parsing is not XSD/schema validation. DTDs and custom entities are rejected; external resources are not requested. UTF-16 and other encodings require conversion to UTF-8 first. Invalid or oversized input creates no download, and editing clears old results.

Rate this tool

Loading ratings…