XML to JSON Converter

XML still runs a surprising amount of the web — RSS feeds, sitemaps, legacy APIs and config files. But modern JavaScript codebases think in JSON, and hand-translating between the two is error-prone busywork. Our free XML to JSON Converter parses your XML locally and produces clean, formatted JSON: repeated sibling elements become arrays, attributes are preserved under @-prefixed keys, and mixed-content elements keep their text under a #text key so nothing is silently dropped. No signup, no upload.

Because the conversion happens entirely in your browser, sensitive feeds and private configs stay on your machine. Malformed XML gets a plain-English error message quoting the parser’s complaint instead of failing silently. The output is indented and readable, ready to paste into code, a test harness or a no-code automation.

Copy the JSON or download it as a .json file in one click. It is handy for developers migrating endpoints, SEOs inspecting sitemap XML, and anyone who wants XML’s structure in a format JavaScript natively understands.

XML to JSON Converter

Convert XML documents into formatted JSON with attributes preserved.

Conversion rules: repeated sibling elements become arrays, XML attributes become @attr keys, and an element that mixes text with child elements keeps its text under #text.

How to use

  1. Paste your XML into the text box.
  2. Click Convert to JSON.
  3. Review the formatted JSON in the output area.
  4. Click Copy JSON to copy it, or Download .json to save the file.
  5. If the XML is invalid, read the error message and fix the reported problem.
  6. Use Clear to start over.

FAQs

What happens to XML attributes?

Attributes are preserved with an @ prefix: <book id=”1″> becomes {“book”: {“@id”: “1”}}. This mirrors the attribute convention used by our JSON to XML Converter, so round-trips stay consistent.

How are repeated elements handled?

Sibling elements with the same tag name are collected into a JSON array automatically — for example, three <item> elements become “item”: […]. A single element stays a plain object.

What does the #text key mean?

When an element contains both text and child elements, its text content is stored under “#text” so nothing is lost. A pure-text element with no attributes converts to a plain JSON string with no extra keys.