XML to JSON
Turn an XML document into clean JSON, with options to keep or strip element attributes.
How it works
- 1
Paste your XML document into the input area. If the XML is not well-formed, the tool reports the exact line and column where the problem is.
- 2
Toggle whether element attributes (like id="1") should appear in the output, and set the indent width for the JSON.
- 3
Click Convert to JSON — copy the result or download it as output.json.
Questions
What happens when I paste invalid XML?
The tool validates the document before converting and shows a readable error message that includes the line and column number where the problem was found.
What does including attributes do?
When the toggle is on, element attributes are kept in the JSON output and prefixed with @ to distinguish them from child elements. Turn it off to get a leaner result that contains only element text and children.
How are repeated elements represented?
When the same tag appears more than once at the same level, the parser collects the values. The exact structure depends on the parser's grouping rules — inspect the output to confirm the shape before you use it in code.
Is my XML uploaded anywhere?
No. Conversion runs entirely in your browser. Nothing you paste is sent to any server.
More converter tools
Image to PDF
Combine JPG, PNG, WebP, GIF, or BMP pictures into a single PDF, one page per image, right in your browser.
SVG to PNG
Rasterize an SVG file to a PNG image at any export scale or an exact pixel size you specify.
CSV ↔ JSON Converter
Convert CSV to JSON or JSON back to CSV in one tool — paste your data and pick a direction, or let it auto-detect.
HEIC to JPG
Convert HEIC and HEIF photos from your iPhone or iPad to JPG, PNG, or WebP right in the browser.