JSON output will appear here
Paste XML on the left and click Convert// convert xml to clean json in one click
XML to JSON Converter — paste any XML and get clean, formatted JSON instantly. Handles attributes, arrays, and namespaces. Browser-based, free, no sign-up required.
JSON output will appear here
Paste XML on the left and click ConvertType or paste any valid XML document into the left panel, or click Load Sample to try an example.
Pick how attributes are handled (prefix, merge, or ignore) and set your indentation preference.
Click Convert, then copy the JSON to clipboard or download it as a .json file.
XML (eXtensible Markup Language) and JSON (JavaScript Object Notation) are both formats for storing and transmitting structured data. While XML dominated early web services, JSON has become the default for modern REST APIs. This tool converts any XML document into clean, equivalent JSON — handling attributes, repeated sibling elements (auto-converted to arrays), mixed content, and namespaces.
You have three options. Prefix @ maps each attribute to a JSON key prefixed with @ (e.g. @id). Merge places attributes alongside child elements at the same level. Ignore drops all attributes entirely and only converts element content.
Whenever two or more sibling elements share the same tag name, this tool automatically groups them into a JSON array. For example, multiple <item> elements under a <list> parent become "item": [...].
Yes. Namespace prefixes are preserved in the JSON key names (e.g. ns:element becomes the key "ns:element"). The xmlns namespace declarations are treated as attributes and handled according to your attribute setting.
No. Everything runs entirely in your browser using JavaScript. No data is uploaded, logged, or stored anywhere. Your XML never leaves your machine.
When an element has both text content and child elements, the text is placed under a #text key (or value depending on your setting) alongside the child element keys. This preserves all information from the original XML.
Yes, for reasonably sized files. Since processing happens in the browser, very large files (10 MB+) may be slow depending on your device. For extremely large datasets, a server-side solution or CLI tool like xml2json is recommended.
Minify removes all whitespace and newlines from the JSON output, producing a single-line compact string. This is useful when you need to embed the JSON in a variable, store it in a database field, or reduce payload size.
Yes. CDATA sections (<![CDATA[...]]>) are parsed by the browser's native DOMParser and their text content is extracted cleanly into the corresponding JSON string value, with no CDATA markers in the output.
XML and JSON are the two most common formats for structured data exchange on the web. Despite JSON's dominance in modern APIs, XML remains widely used in enterprise systems, configuration files, RSS feeds, SOAP services, SVG graphics, and countless legacy integrations. When you need to move data between these two worlds, this XML to JSON Converter gives you a clean, reliable result without any server round-trip.
The conversion follows a well-established set of rules. XML elements become JSON object keys. Simple text content becomes string values. Repeated sibling elements with the same tag name are automatically collected into JSON arrays — so <item> repeated five times becomes "item": [...] with five entries. Attributes are handled separately: you can prefix them with @, merge them alongside child elements, or drop them entirely depending on your needs.
XML attributes are a common pain point when converting to JSON because JSON has no native equivalent. The Prefix @ strategy is the most explicit: each attribute becomes a key prefixed with @, so <user id="1"> yields { "@id": "1", ... }. The Merge strategy places attribute values alongside child element keys at the same level — cleaner but potentially ambiguous if an attribute and a child share the same name. The Ignore strategy simply discards all attributes, useful when you only care about element content.
RSS and Atom feeds are XML-based and need conversion when building JSON APIs or podcast apps. SOAP web service responses return XML envelopes that must be parsed into JSON for JavaScript frontends. Maven pom.xml files, Android AndroidManifest.xml, and Spring configuration files all use XML structures that developers occasionally need in JSON form. KML files from Google Maps, XSLT stylesheets, and OpenDocument formats are also common conversion targets.
Many online XML converters upload your data to a server for processing. This is a privacy concern when your XML contains API keys, user data, internal configuration, or proprietary business logic. This tool processes everything locally in your browser using the native DOMParser API — your data is never transmitted anywhere.