CLOUDE TOOLS · DEVELOPER TOOLS
XML to JSON
Convert XML to JSON, preserving attributes.
Output
{
"?xml": {
"@_version": "1.0"
},
"root": {
"item": [
{
"#text": "A",
"@_id": "1"
},
{
"#text": "B",
"@_id": "2"
}
]
}
}HOW IT WORKS
How to use the XML to JSON
Paste your input, adjust the options if needed, then press Run or watch the result update live.
Check the options under the input if the tool offers any.
Review the result below the form.
Copy the result or download it where a download button is shown.
Use “Load example” to see a representative input.
EXAMPLES & USE CASES
See it in action
Input
text="<?xml version=\"1.0\"?><root><item id=\"1\">A</item><item id=\"2\">B</item></root>"
Output
{
"?xml": {
"@_version": "1.0"
},
"root": {
"item": [
{
"#text": "A",
"@_id": "1"
},
{
"#text": "B",
"@_id": "2"
}
]
}
}| Error | Example | Fix |
|---|---|---|
| Trailing comma | {"a": 1,} | Remove the comma after the last item |
| Single quotes | {'a': 1} | Use double quotes for keys and strings |
| Unquoted key | {a: 1} | Quote every key: {"a": 1} |
| Comments | {"a": 1 // note} | JSON has no comments; remove them |
| NaN / undefined | {"a": NaN} | Use null or a number |
Namespaces are kept as plain names. Mixed content ordering is not preserved.
DETAILED GUIDE
About the XML to JSON
Paste XML and get JSON. Attributes get an @_ prefix and text is under #text.
Invalid XML is reported with a line number.
FAQS & RESOURCES
Frequently asked questions
Attributes?
Prefixed with @_.
Repeated elements?
Become arrays.
Invalid XML?
The line is shown.
Is this tool free?
Yes. Cloude Tools is free to use with no sign-up.
Is my data uploaded to a server?
No. This tool runs entirely in your browser, so what you enter never leaves your device.
Does it work on mobile?
Yes. The tool is designed to be fully usable on a phone.