Search tools

XML to JSON Converter

Turn XML from APIs, feeds and config files into JSON you can work with in JavaScript and Python.

XML to JSON Converter tool

Options

Processing runs in your browser.

XML is verbose to read and awkward to use from modern code, which generally expects JSON. Converting it lets you inspect a SOAP response, an RSS feed or a config file as plain data, or pass it on to a JSON-based system.

Common uses

  • Legacy APIs: inspect SOAP or XML-RPC responses.
  • Feeds: turn RSS, Atom or sitemap XML into JSON for scripts.
  • Office and config files: read data from XML configs.
  • Migrations: move records from XML exports into JSON-based databases.

To format XML without converting it, use the XML Formatter.

How to use the XML to JSON Converter

  1. Paste XML, or open an .xml file.
  2. Choose whether to keep attributes (as keys starting with @).
  3. Fix any well-formedness error shown with its line and column.
  4. Copy or download the JSON.

Features

  • Validates the XML first and reports the exact position of errors.
  • Repeated elements become arrays automatically.
  • Attributes are kept as @name keys, or dropped if you only need element text.
  • Numbers in element text are converted; attribute values stay strings.

Frequently asked questions

How are attributes represented in JSON?

As keys starting with @. <book id="1"> becomes {"book": {"@id": "1", …}}. Untick Keep attributes if you don’t need them.

Why is an element sometimes an object and sometimes an array?

An element that appears once becomes an object; one that appears several times becomes an array. If your code needs a consistent shape, check for both or normalise afterwards.

What does “well-formed” mean?

Every tag is closed, tags are properly nested, attribute values are quoted, and there’s one root element. It doesn’t check a schema (XSD) — only the basic XML rules.

Written by