XML to JSON Converter
Paste XML to get clean JSON instantly. Attributes, nested elements, repeated tags, CDATA and entities are all handled, and your data stays in your browser.
How to convert XML to JSON
- Paste or type your XML into the input box.
- Choose options like value parsing or the attribute prefix if you need them.
- Copy the JSON or download it as a .json file.
Examples
Element with an attribute
<user id="1"><name>Ada</name></user>
{
"user": {
"@id": "1",
"name": "Ada"
}
}Repeated tags become an array
<list><item>a</item><item>b</item></list>
{
"list": {
"item": [
"a",
"b"
]
}
}Frequently asked questions
Is my data uploaded anywhere?
No. The conversion runs entirely in your browser, so your XML never leaves your device.
How are XML attributes represented in the JSON?
Attributes become keys prefixed with @ by default, for example id="1" becomes "@id": "1". You can change or remove the prefix.
How are repeated XML elements handled?
Sibling elements that share a tag name are grouped into a JSON array. A tag that appears once stays a single value, not an array.
What happens to an element that has both text and attributes?
The text is stored under a "#text" key alongside the attributes, so nothing is lost. You can rename this text key.
Are numbers and booleans converted to real JSON types?
Only if you turn on value parsing. By default every value stays a string for fidelity, so ids and zip codes keep leading zeros.
Does it handle CDATA, comments and entities?
Yes. CDATA sections become literal text, comments and the XML declaration are skipped, and entities like & and 😀 are decoded.
What happens with invalid XML?
You get a clear error that points at the problem, such as a mismatched closing tag, an unclosed element or multiple root elements.
Related tools
JSON to XML
Convert JSON to XML online. Paste JSON and get clean, indented XML with a custom root element. Special characters are escaped. Runs in your browser.
JSON to CSV
Convert JSON to CSV online. Paste an array of objects and get clean, spreadsheet-ready CSV with the right headers. Runs in your browser.
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
YAML to JSON
Convert YAML to JSON online. Paste YAML and get clean, pretty-printed JSON with the indentation you choose. Runs entirely in your browser.
Air Fryer Converter
Convert any conventional oven recipe to air fryer settings. Lower the temperature by 25 F and cut the cook time by about 20 percent automatically.
Baker's Percentage Calculator
Turn a bread formula into grams with baker's percentages. Flour is 100 percent, enter water, salt and yeast percents to get weights and hydration.