Convert XML to JSON instantly
Convert XML to JSON in your browser. No upload, no signup needed. Free, private, instant XML to JSON conversion.
Drop your XML file here
or click to browse
Example
Input (XML)
<user> <name>Alice</name> <age>30</age> </user>
Output (JSON)
{ "user": { "name": "Alice", "age": "30" } }About this converter
XML served the web well for two decades, but modern APIs, JavaScript frameworks, and NoSQL databases all speak JSON. This converter parses your XML using the browser's built-in DOMParser and maps elements to JSON properties. Repeated child elements with the same tag automatically become arrays. The conversion is local. Your XML never leaves your browser, which is important if you are converting config files with credentials or proprietary data feeds.
The parser handles standard XML structures well. Simple key-value elements become JSON properties, nested elements become nested objects, and sibling elements that share a tag name are grouped into arrays. CDATA sections are treated as plain text. The main limitation is XML attributes, which the current version does not extract. If your XML relies heavily on attributes for data (common in some SOAP responses), the output may be incomplete.
You typically need this when migrating from an older system that speaks XML to a modern stack that expects JSON. Pulling data from a SOAP API and feeding it into a React frontend. Parsing an RSS feed into a JavaScript object. Converting Android resource files into a format your Node.js tooling can work with. Instead of writing a custom parser with xml2js or xmldom, just drop the file here.
Going the other way? JSON to XML does the reverse. If you need tabular output, try XML to CSV. For configuration workflows, XML to YAML can be handy too.
XML vs JSON
Extensible Markup Language (XML)
XML (Extensible Markup Language) is a markup language for encoding documents and data in a format that is both human-readable and machine-readable.
Common uses: data interchange, configuration, and document markup
W3C XML specificationJavaScript Object Notation (JSON)
JSON (JavaScript Object Notation) is a lightweight data format that is easy for humans to read and write, and easy for machines to parse and generate.
Common uses: APIs, web applications, and configuration files
ECMA-404 (JSON specification)How to convert XML to JSON
- 1
Get your XML file
Make sure the XML is well-formed with proper opening and closing tags. The converter uses the browser's DOMParser, which is strict about syntax. Invalid XML will produce an error.
- 2
Load or paste the XML
Drag your .xml file onto the converter or switch to paste mode and paste the raw XML. Parsing happens locally in your browser using the DOMParser API.
- 3
Review the JSON output
Check that the element hierarchy maps correctly to JSON objects. Repeated sibling elements should appear as arrays. Note that XML attributes are not currently extracted.
- 4
Download or copy the JSON
Save the output as a .json file or copy it to your clipboard. The JSON is formatted with indentation for readability.
Frequently Asked Questions
Last updated: 2026-03-23