XML to JSON Converter
Convert XML into JSON using a small built-in parser.
Enter your details below.
How to use
- Paste your XML into the box.
- Click Convert to JSON.
- Copy the JSON result.
About this tool
This tool parses XML with a small parser written for this page, without relying on a browser XML parser, so the same logic can run in plain JavaScript environments too. Elements become objects, repeated child elements become arrays, and text values are converted to numbers or booleans when they clearly look like one, otherwise they stay as text. Element attributes are not preserved, and comments and processing instructions are skipped. Mismatched tags are reported as an error instead of producing a partial result.
Frequently asked questions
Are attributes kept?
No. This small parser reads elements and text only, so attributes are skipped.
Why is age a number, not text?
Because text that looks exactly like a number is converted to a number, and true and false become booleans. Other text stays as a string.