✍️ TextWonder 📄 PDFWonder 📁 DocWonder 🖼️ ImageWonder 🛠️ DevWonder 🎓 StudentWonder 🧮 CalcWonder 🩺 HealthWonder 🎨 ColorWonder 💾 DataWonder 📐 UnitWonder

XML to JSON Converter

Convert XML documents to JSON format instantly.

About XML to JSON Converter

Paste any XML document and instantly convert it to formatted JSON. Handles nested elements, attributes (prefixed with @), text content, and XML arrays. Useful for processing RSS feeds, API responses, config files, and SOAP data in JavaScript environments.

Use Cases

Converting RSS/Atom feeds to JSON for JavaScript apps, transforming SOAP XML API responses, processing XML config files in Node.js, migrating legacy XML data to JSON databases, parsing SVG or HTML as structured data.

How It Works

Uses the browser's built-in DOMParser to parse the XML into a DOM tree, then recursively converts each node to a JavaScript object — attributes become "@attr" keys, text content becomes a "text" or "#text" key, and child elements become nested objects or arrays.

Frequently Asked Questions

What happens to XML attributes?

Attributes are included in the JSON object with an "@" prefix. For example, <item id="1"> becomes { "@id": "1", ... }.

What if an element appears multiple times?

Repeated sibling elements with the same tag name are grouped into a JSON array automatically.

Does it handle XML namespaces?

Namespaced elements are included with their full qualified name (e.g. "ns:element"). Namespace declarations are preserved as "@xmlns" attributes.

Related Tools