0 chars
Conversion Rules
XML element→JSON object key
XML attribute→@attributeName key
Text-only element→String / number / boolean value
Repeated elements→JSON array
Mixed content (text + children)→#text key for text
CDATA→Plain string value
What is XML to JSON Converter?
This tool converts XML documents to JSON format entirely in your browser. Paste any valid XML and click Convert — it handles nested elements, attributes, repeated elements (arrays), CDATA sections, and mixed content.
How to Use
- Paste your XML into the input panel on the left (or click "Load Example" to try a sample)
- Click "Convert to JSON" to parse and transform the XML
- Review the JSON output in the right panel
- Click "Copy" to copy to clipboard, or "Download" to save as a .json file
- If there is a parse error, the tool shows exactly which part of the XML is invalid
Why Use This Tool?
Runs entirely in your browser — no data is sent to a server
Handles attributes (converted to @attr keys), arrays, and CDATA automatically
Supports nested elements of any depth
Auto-detects numbers and booleans — no string wrapping of numeric values
Download output as a .json file with one click
Handles XML namespaces and processing instructions gracefully
Tips & Best Practices
- XML attributes become @attributeName in JSON (e.g., id="1" → "@id": "1")
- Repeated sibling elements with the same tag become a JSON array automatically
- Text-only elements become simple string/number/boolean values, not objects
- CDATA sections are treated as plain text — the CDATA wrapper is stripped
- The XML declaration (<?xml version="1.0"?>) is ignored and does not appear in output
- For large files, copy-paste works fine — the browser DOM parser handles files up to hundreds of MB