# XML ⇄ JSON

> Convert XML to JSON and back. Runs entirely in your browser — nothing you paste is sent anywhere.

Source: https://toffeekit.com/tools/xml-json-converter

**Category:** [Data](https://toffeekit.com/category/data) · **Price:** Free · **Runs:** in your browser, nothing is uploaded

Open the tool: https://toffeekit.com/tools/xml-json-converter

**Also useful for:** xml, json, convert, feed

## How it works

1. Choose a Direction: XML to JSON or JSON to XML.
2. Paste your XML or JSON into the Input box, or click Sample.
3. Toggle Keep attributes (@id) to decide whether XML attributes are included.
4. Click Copy or Save to download data.json or data.xml, or press Swap to convert back.

## FAQ

### How do I convert XML to JSON?

Set Direction to XML to JSON and paste the XML. Elements become keys, and repeated elements with the same name become arrays.

### What happens to XML attributes?

With Keep attributes on, they appear in the JSON with an @ prefix, so id="1" becomes "@id": "1". Turn it off to drop attributes completely.

### Why does it say Line 3 with an XML error?

The XML is not well formed, for example a missing closing tag or an unescaped &. The error shows the line so you can fix it.

### Can I convert an RSS feed or SOAP response?

Yes. Paste the XML and you get the same data as JSON, which is easier to work with in JavaScript.

### Are numbers in XML turned into JSON numbers?

Yes, element text that looks like a number or boolean, such as 2026, is written as a JSON number rather than a string. Attribute values stay as strings.

### Is XML ⇄ JSON free and private?

Yes. It's free with no sign-up or limits, and it runs entirely in your browser, so your files are processed on your device and never uploaded. It works on phones and computers alike.

## Privacy

XML ⇄ JSON runs entirely in your browser. Your files and text are processed on your device and are never uploaded.

## Related tools

- [CSV to JSON](https://toffeekit.com/tools/csv-to-json) — Turn CSV rows into JSON objects.
- [JSON to CSV](https://toffeekit.com/tools/json-to-csv) — Flatten JSON into a CSV you can open in Excel.
- [CSV Cleaner](https://toffeekit.com/tools/csv-cleaner) — Trim cells, drop empty rows, remove duplicates.
- [Delimiter Converter](https://toffeekit.com/tools/csv-delimiter-converter) — Switch between comma, semicolon, tab and pipe.
- [CSV Viewer](https://toffeekit.com/tools/csv-viewer) — Open a CSV as a sortable, searchable table.
- [JSON Viewer](https://toffeekit.com/tools/json-viewer) — Explore JSON as a collapsible tree.

