XML to JSON Converter

Turn XML into clean JSON — nested elements become objects, repeated tags become arrays, attributes optional. Runs in your browser; nothing is uploaded.

How to Convert XML to JSON

Three steps, all in your browser.

1

Paste or load your XML

Paste XML text into the box, or click “Load .xml file” to open a feed, config or API response. The tool converts as you type — no button to press.

2

Pick your options

Keep “Include attributes” on to carry XML attributes across as @-prefixed keys, and Pretty-print for readable output. Working with tables instead? Try the CSV to JSON Converter or tidy the result with the JSON Formatter.

3

Copy or download

The JSON appears in the output box. Hit Copy JSON to send it to your clipboard, or Download .json to save a file. Nothing is uploaded — it all happens on your device.

Frequently Asked Questions

How do I convert XML to JSON?
Paste your XML into the input box, or load a .xml file. The tool parses it with the browser's built-in XML parser and builds JSON instantly as you type. Each XML element becomes a key; nested elements become nested objects; and when a tag repeats inside its parent, those elements are grouped into a JSON array. Then click Copy JSON or Download .json.
Is my data uploaded anywhere?
No. The conversion runs entirely in your browser with JavaScript. The XML you paste or the file you load is parsed on your own device and is never sent to a server, logged, or stored. You can safely convert private feeds, config files or API responses, and the tool keeps working offline once the page has loaded. Closing or refreshing the tab clears everything.
How are attributes and repeated tags handled?
With “Include attributes” enabled, each XML attribute becomes a JSON key prefixed with an @ symbol — for example, <book id="1"> becomes "@id": "1" — which keeps attributes distinct from child elements. When the same tag appears more than once inside a parent, those entries are collected into a JSON array so nothing is lost or overwritten. An element that contains only text becomes that text value directly.
What happens if my XML is invalid?
The tool uses the browser's native parser, which reports the first syntax problem it finds — such as a missing closing tag or a stray character. That message is shown under the input box so you can fix the XML and see the JSON update immediately. Well-formed XML with a single root element converts cleanly.
Can it pretty-print the JSON?
Yes. Pretty-print is on by default, indenting the JSON with two spaces so it is easy to read and diff. Turn it off to get compact, minified JSON on a single line — handy when you want the smallest payload to paste into code or send over the wire.