Paste XML and click Convert. The tool parses your XML using the browser's built-in DOMParser and produces a JSON object that mirrors the element structure. Attributes, text content, and nested elements are all represented in the output.
Free, fast, runs in your browser. No login needed.
The converter uses the browser's native DOMParser to parse XML, then recursively converts the DOM tree to a JSON object using these rules:
<name>Alice</name> → "name": "Alice"."@" key as an object: <item id="1"> → {"@": {"id": "1"}, ...}.Namespaces. Namespace prefixes become part of the key name as-is. For example, <ns:item> produces the key "ns:item". Namespace declarations (xmlns attributes) appear under the "@" key.
Mixed content. If an element contains both text and child elements, the text node content is assigned directly to the object (overwriting it). This is an edge case — avoid XML with mixed content for best results.
Common use cases: converting API responses or data feeds from XML to JSON for use in JavaScript applications; migrating XML config files to JSON; inspecting XML structure in a more readable format.
Attributes are collected under a special "@" key as an object. For example,
The first occurrence creates a single value. When the same tag name appears a second time under the same parent, the values are automatically merged into an array. All subsequent occurrences are pushed onto that array.
Namespace prefixes are preserved as part of the key name (e.g., "ns:item"). Namespace URI declarations appear as attributes under the "@" key. Namespace-aware merging is not performed.
Yes. Use the JSON to XML tool on this site. Note that the "@" attribute convention and array-to-siblings mapping are the reverse of what JSON to XML produces.
No. Parsing runs entirely in your browser using the native DOMParser.