Skip to tool

RaahUPSC · File & Data Tools

XML to JSON Converter

Convert an XML document into an equivalent JSON structure that keeps the full hierarchy, including attributes and repeated elements.

✓ No upload  ·  ✓ No sign-up  ·  ✓ No watermark

How to use XML to JSON Converter

  1. Add one or more .xml files.
  2. Click Convert to JSON.
  3. Copy the indented JSON or download it as a .json file.

Mapping rules

The browser's own DOMParser reads the file, so malformed XML is rejected with the parser's error message. The root element becomes the top-level key. Attributes become keys prefixed with @, elements that repeat under the same parent turn into arrays, and an element holding only text becomes a plain string. When an element has attributes and text, the text is stored under #text.

Useful for RSS feeds, government open-data downloads, sitemap files and legacy system exports that you want to process in JavaScript or inspect more easily.

Limitations

  • All values stay as strings; numbers and booleans are not converted.
  • A single child element is an object, while two or more become an array, so the shape can differ between files.
  • Text mixed between child elements is dropped, and comments and processing instructions are not kept.

Frequently asked questions

How are XML attributes represented?

As keys starting with @, for example {"@id": "12"}.

Are namespaces supported?

Prefixed names such as dc:title are kept as written in the key names; namespace declarations appear as @xmlns attributes.

Why is a number in quotes?

XML has no data types, so every value is kept as text to avoid guessing wrongly.

Does my XML leave the device?

No, it is parsed and converted within your browser.

More File & Data Converters

Free, private and no sign-up. Everything runs in your browser.