XML to JSON Converter

Convert any well-formed XML to clean JSON in your browser. Handles attributes, arrays, namespaces. Free and private. 100% free, private, and browser-based.

How to use

  1. Paste XML — Drop any well-formed XML — SOAP, RSS, sitemap, config.
  2. Choose Options — Keep XML attributes as @attributes; toggle pretty indent.
  3. Copy JSON — Use the JSON in your app, API, or spreadsheet.

Frequently asked questions

How are XML attributes represented?

Attributes are placed under a special '@attributes' key on the element, following the common XML→JSON convention used by libraries like xml2js. Toggle this off to drop attributes.

What if two child elements share a tag name?

They are automatically collected into an array. For example, two <book> children become an array of book objects, preserving order.

Are CDATA and comments preserved?

CDATA contents are returned as plain text. Comments and processing instructions are stripped (standard XML→JSON behaviour).

What does '#text' mean in the output?

When an element has both attributes and text content, the text is placed under '#text'. This avoids collisions with the '@attributes' object.

Does it handle XML namespaces?

Yes — preserved as `@xmlns:prefix` keys in the output.

What about mixed content?

Emitted as an array of text and element entries; check the docs in the SEO content above.

Is my XML uploaded?

No — parsing runs entirely in your browser.

Will it validate against a schema?

No — for XSD validation use a dedicated validator. This tool focuses on structural conversion.

Is the output formatted?

Yes — choose 2-space, 4-space, or minified.

The XML to JSON Converter turns any well-formed XML document into a clean JSON tree using the browser's native DOMParser. Use it to migrate legacy XML APIs to modern JSON pipelines, convert RSS feeds for use in JavaScript, or reshape SOAP responses for use in Node.js.

Convention used

  • Each element becomes a JSON object keyed by its tag name.
  • Attributes are placed under "@attributes" (configurable).
  • Repeated child tags become arrays automatically.
  • Elements with both attributes and text use "#text" for the text content.

Common use cases

  • Convert RSS/Atom feeds for use in JavaScript apps.
  • Reshape SOAP responses for REST gateways.
  • Import OpenDocument or KML data into JSON databases.
  • Inspect sitemap.xml as a JSON tree.

Privacy

Parsing runs entirely in your browser. Confidential XML — SAML assertions, signed business documents, internal sitemaps — never leaves your device.

Related free tools

  • YAML ↔ JSON Converter — Convert YAML to JSON and JSON to YAML in both directions.
  • Image to Base64 — Encode images to Base64 data URLs and decode Base64 to images.
  • HTML Formatter — Beautify minified or scraped HTML with consistent indentation. Pure browser JavaScript, comments preserved.
  • JSON Sort Keys — Recursively sort every JSON object key alphabetically. Cleaner diffs, canonical configs, deterministic output.
  • HTTP Status Code Lookup — Search and filter every common HTTP status code with meanings, categories, and SEO context.
  • Subnet Calculator — Calculate IPv4 subnet details from any IP address and CIDR prefix. Network, broadcast, usable range, mask.
  • HTML to Markdown — Convert HTML to clean Markdown for Git, Hugo, Astro, or README files. DOMParser-based, 100% private.
  • JavaScript Escape / Unescape — Escape strings for Unicode, regex, HTML, and URL contexts — or unescape them back.
  • HTML Table to CSV — Extract data from HTML tables into clean CSV format. Supports multiple tables and custom delimiters.
  • TSV to CSV Converter — Convert tab-separated data to RFC 4180-compliant CSV.
  • MIME Type Lookup — Search MIME content types by extension or name.
  • User Agent Parser — Decode any User-Agent string into browser, OS, and device.

Browse all free tools · Guides and tutorials · PDF tools · Developer tools · Text tools · SEO tools