XML to JSON Converter - Free Online XML2JSON Tool
Convert XML to JSON directly in your browser - the conversion runs on your device, and your XML is never uploaded to a server. Paste XML or upload a file and the JSON appears as you type - no button to press, no account needed. Set the output indentation, choose your own attribute prefix, and inspect the result as code or an expandable tree before you copy or download it. Built for developers reshaping API responses, config files, RSS feeds, and SOAP payloads into clean JSON.
How XML Maps to JSON
The converter follows the standard mapping rules developers expect. Element names become JSON keys and element text becomes values. XML attributes are preserved as prefixed keys - id="101" becomes "@id": "101" by default, so attributes never collide with child elements. When the same tag repeats inside a parent - several <employee> elements, for example - the converter outputs a JSON array; a tag that appears once stays a single object. Namespaces come through too: xmlns:x="urn:y" arrives as "@xmlns:x": "urn:y". The XML declaration, comments, and processing instructions do not, because JSON has nowhere to put them.
Your ZIP Codes and Order Numbers Come Through Intact
<zip>02134</zip> and you get "02134", with the leading zero still there. A part number of <part>007</part> stays "007", and a reference written as 0x1A or 1e5 arrives exactly as you wrote it. Real measurements still become real numbers, so <qty>42</qty> is 42, <price>3.14</price> is 3.14, and <paid>true</paid> is true. It is the difference that bites in SOAP envelopes, ERP exports, and product feeds: order numbers, postal codes, and SKUs are the first things a conversion mangles, and you usually find out much further downstream.Custom Indentation and Attribute Prefix
Choose an indentation level from 2 to 10 spaces for the JSON output, so the result matches your project's formatting conventions before you download it. The attribute prefix is yours to set: the default is @, and you can replace it with a short marker of your own - _, $, or a project-specific string - or clear the field to drop the prefix entirely. The output updates in real time as you type. This matters when the JSON feeds a downstream parser with its own naming rules, or when your codebase already standardizes on a particular attribute convention.
Code View to Copy, Tree View to Inspect
.json download. Tree view is for checking the conversion did what you expected: expand and collapse nested objects, confirm that repeated tags became arrays, and trace a deeply nested structure without counting braces. Both views have Copy and Download to hand, and a fullscreen mode for documents too big to read in a panel. To keep editing the result after conversion, open it in the JSON formatter.How to Use Our XML to JSON Converter
- Paste your XML into the input editor, click File to upload an .xml document, or click Sample to see the mapping with example data.
- Pick the indentation level (2-10 spaces) and set the attribute prefix if your project needs one - the default is @, and clearing the field removes the prefix.
- The JSON appears as you type. If something in the XML is broken, you get the line and column of the problem and a marker on that line, so you can go straight to it. To debug the XML first, run it through the XML validator.
- Check the structure in Tree view or the text in Code view, then copy the JSON to your clipboard or click Download. Downloads are named after the source file - upload
invoice.xmland you getinvoice.json.