XML to JSON
Bring XML records into your JSON workflow.
Loading converter…
Maximum input: 5 MB. Files are processed locally; large outputs are available as downloads with a shortened preview.
Need another format or found a problem? Send feedback ↗
How to use XML to JSON
- Add your XML data. Paste text or select a file from your device.
- Choose your options. Review the settings and select Convert.
- Save your result. Preview, copy, or download the output.
Know your output.
XML attributes use @_, text uses #text, and JSON exports are wrapped in a root element. Mixed-content XML and round trips may change structure. Standard character entities are decoded; DTD and entity declarations are not supported.
Conversion happens locally. Refreshing or closing this tab clears the workspace; downloaded files remain on your device.
XML to JSON: conversion behavior
Convert XML elements and attributes into JSON locally. Attributes use @_ prefixes, text alongside attributes uses #text, and element text stays string data.
Use it to inspect simple XML records or feeds. Review repeated elements and mixed content before using the output.
- An id="001" attribute becomes an @_id property with a string value.
- Repeated sibling elements can become arrays; a single occurrence may remain a single value. There is no fixed-array schema option.
- Standard character entities such as & are decoded. DTD and entity declarations are rejected.
- Mixed content, namespace semantics and exact whitespace are not guaranteed to survive a round trip.
XML attributes, text and repeated elements
Repeated item elements become an array. Attribute id becomes @_id, text becomes #text, and 001 stays a string. Paste this XML above and compare the JSON result.
<catalog><item id="001">Alpha</item><item id="002">Beta</item></catalog>Download input{
"catalog": {
"item": [
{
"#text": "Alpha",
"@_id": "001"
},
{
"#text": "Beta",
"@_id": "002"
}
]
}
}Download expected outputQuestions about XML to JSON
Why are numbers in quotes?
Element and attribute values stay strings so values such as 001 are not automatically rounded or stripped.
Can I convert XML with a DTD?
No. Use an input without DTD or entity declarations.
Content reviewed · Conversion behavior & testing