XML to JSON

Convert XML — including RSS and Atom feeds — to clean, readable JSON. Attributes, repeated elements and text nodes are kept. Paste XML and get JSON instantly, in your browser.

Suggested tools

JSON to XML

Convert JSON into well-formed XML.

JSONXML
Open Tool

XML Formatter

Beautify, minify and validate XML instantly in your browser.

XML
Open Tool

XML to CSV

Turn list-style XML into a CSV table, one row per record.

XMLCSV
Open Tool

CSV to XML

Convert CSV rows into well-formed XML elements.

CSVXML
Open Tool

XML to YAML

Convert XML into YAML.

XMLYAML
Open Tool

YAML to XML

Convert YAML into XML.

YAMLXML
Open Tool

About XML to JSON

XML to JSON converts XML — including RSS and Atom feeds, SOAP responses and config files — into JSON that is easy to use in JavaScript, Python or any API. Elements become keys, repeated elements become arrays and attributes are kept with an @_ prefix.

Values such as 007, +919876543210 or 1E5 stay exactly as written instead of being turned into numbers, so codes and phone numbers survive. You can choose 2- or 4-space indentation. It runs entirely in your browser, so nothing you paste is uploaded.

How to use XML to JSON

  1. Paste XML, upload a file or click Sample.
  2. Press Convert.
  3. Copy or download the JSON.

Key features

  • Attributes preserved (@_ prefix)
  • Repeated elements become arrays
  • Leading zeros and codes kept as text
  • Checks the XML is well-formed first

Example

The id attribute is kept with an @_ prefix.

Input
<book id="42"><title>Gitanjali</title><author>Rabindranath Tagore</author><year>1910</year></book>
Output
{
  "book": {
    "title": "Gitanjali",
    "author": "Rabindranath Tagore",
    "year": 1910,
    "@_id": "42"
  }
}

When to use XML to JSON

  • Turning an RSS or Atom feed into JSON for a website or app.
  • Reading SOAP or legacy API responses in JavaScript.
  • Converting XML exports into JSON for a NoSQL database.

Tips and common problems

  • Elements that appear once become objects and repeated ones become arrays — code should handle both.
  • Attributes appear with an @_ prefix, e.g. "@_id".
  • Values like 007 or phone numbers are kept as text.

Frequently asked questions

Yes. Paste the feed's XML (open the feed URL and copy the page source) and each <item> becomes an entry in a JSON array.

Guides

  • JSON vs XML vs YAML — JSON vs XML vs YAML compared: strengths, weaknesses and best uses, to help you choose the right data format for APIs, config files and documents.