XML to JSON Converter

Convert XML to JSON online. Paste an XML document and get clean JSON instantly — handles nested elements, attributes, repeated tags, and CDATA, all in your browser.

Input XML
Drop XML file here
JSON Output

Features

🏷️ Faithful XML Handling

  • Nested elements become nested JSON objects
  • Repeated sibling tags become JSON arrays
  • Attributes captured with an @ prefix
  • CDATA sections and comments handled correctly

⚡ Privacy-First

  • Uses your browser's native, spec-compliant XML parser
  • No data ever sent to a server
  • Clear error messages for malformed XML
  • Download or copy the resulting JSON instantly

🔄 Round-Trip Friendly

  • Pairs with our JSON to XML converter
  • Ideal for SOAP/legacy API responses
  • Great for RSS/Atom feeds and config files
  • Toggle attributes off for a cleaner, text-only shape

XML to JSON Guide

XML is still common in enterprise APIs, SOAP services, RSS/Atom feeds, and legacy systems. This converter uses your browser's built-in XML parser (the same one that renders XML documents) so the parsing is fully spec-compliant, then maps elements to JSON objects, repeated tags to arrays, and attributes to @name keys by convention — a widely used approach shared by libraries like xml2js.

Frequently Asked Questions

What happens to XML attributes?

With "Include attributes" checked, each attribute becomes a key prefixed with @ (e.g. id="1" becomes "@id": "1"). If the element also has text content, it's stored under #text. Uncheck the option to discard attributes entirely.

How are repeated elements handled?

When the same tag appears multiple times under one parent, the converter automatically groups them into a JSON array instead of overwriting the key — for example, three <item> tags become an array of three values.

What if my XML is invalid?

The converter reports a parse error with details from the browser's XML parser (unclosed tags, mismatched elements, invalid characters) instead of guessing at a result.