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
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
- Paste XML, upload a file or click Sample.
- Press Convert.
- 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.
<book id="42"><title>Gitanjali</title><author>Rabindranath Tagore</author><year>1910</year></book>
{
"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.
An element that appears once becomes an object; only repeated elements become arrays. Code that reads the JSON should handle both.
Yes, with JSON to XML.
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.