XML to JSON Converter Free
Convert XML to clean, readable JSON instantly in your browser. Handles attributes, text nodes, namespaces, and nested elements. Paste XML and get structured JSON output with no server upload — your data stays private.
XML Input
JSON Output
Pro — XSLT support, XML schema validation, batch file convert, API access
API access · Priority queue · Team workspace
How It Works
Paste Your XML
Paste any valid XML into the input editor — from a REST API response, a SOAP envelope, a configuration file, a sitemap, or any other XML source. Click Sample XML to load a realistic example with nested elements and attributes to explore how the converter handles complex structures before using your own data.
Configure Output
Choose indentation style, whether attributes are prefixed with @ (the JSONBadgerfish convention), whether text content uses the #text key, and whether repeated sibling elements are forced into arrays. These options let you match the JSON structure expected by your application or API without post-processing.
Copy or Download
Copy the JSON to clipboard with one click or download it as a .json file. The stats bar confirms the character counts and total key count in the output. The conversion is instantaneous — even large XML documents with hundreds of elements are parsed in milliseconds by the browser's native DOMParser.
XML to JSON Features
Everything you need to parse XML into structured JSON data
Native DOMParser
Uses the browser's built-in DOMParser API — the same XML engine used to parse SVG, RSS, XHTML, and XSLT in every major browser. This means robust handling of namespaces, CDATA sections, processing instructions, XML comments, and entity references without any third-party library.
Full Nesting Support
Deeply nested XML trees are converted to equivalent nested JSON objects. Child elements become object keys, and repeated sibling elements with the same tag name are automatically collected into JSON arrays. Mixed content (elements with both child elements and text) is handled using the #text convention.
Attribute Handling
XML attributes are mapped to JSON keys prefixed with @ — for example, <user id="1"> becomes {"@id":"1"}. This follows the widely-adopted BadgerFish convention used by many XML-to-JSON libraries, frameworks, and data exchange standards including JAXB and .NET DataContractSerializer.
Array Detection
Sibling elements with the same tag name are automatically merged into JSON arrays. Enable "Force arrays" to always produce arrays for all child elements — useful when consuming XML from APIs where a list might contain only one item, guaranteeing the consuming code always receives an array regardless of item count.
Flexible Formatting
Choose 2-space, 4-space, tab, or minified JSON output. Minified mode strips all whitespace for compact storage or network transmission. Readable modes add indentation to make the structure easy to inspect, debug, and document — especially useful when exploring an unfamiliar XML schema for the first time.
100% Private
Conversion runs entirely in your browser — no XML is transmitted to any server. Safe for SOAP envelopes with credentials, HIPAA medical XML, financial transaction XML, internal API schemas, and any other sensitive XML data that must not leave your device. No account required, no watermarks added.
Free vs Pro
| Feature | Free | Pro |
|---|---|---|
| XML input size | Unlimited | Unlimited |
| Batch file conversion | — | |
| XSLT transform | — | |
| Schema validation | — | |
| Custom key mapping | — | |
| REST API access | — |
Frequently Asked Questions
XML attributes are mapped to JSON keys prefixed with @. For example, <user id="42" role="admin"> becomes {"@id":"42","@role":"admin"}. This BadgerFish convention is widely used in XML-to-JSON libraries across Java, .NET, Python, and JavaScript. You can turn off the prefix in the options to get plain key names instead.
Namespace prefixes are preserved as part of the element name in the JSON key. For example, <soap:Body> becomes the key "soap:Body". Namespace declarations (xmlns:* attributes) are mapped like regular attributes. This approach preserves the namespace information without requiring full namespace-aware processing.
No. The conversion runs entirely in your browser using the browser's built-in DOMParser. No data is uploaded, stored, or transmitted. This makes it completely safe for SOAP envelopes, medical HL7 XML, financial transaction XML, internal API schemas, and any other confidential XML that must not leave your device.
Yes — use the JSON to XML tool from the Data Converters section. It performs the reverse operation, taking a JSON object and producing well-formed XML. The two tools are designed to complement each other for round-trip conversion workflows.