RSS/Atom Feed XML to JSON Conversion

Convert RSS and Atom XML feeds to JSON format. Covers feed structure, channel metadata, item parsing, CDATA in descriptions, and building JSON Feed output.

Real-World

Detailed Explanation

RSS and Atom are XML-based syndication formats used for blogs, news sites, and podcasts. Converting them to JSON is common when building feed readers, aggregators, or displaying feed content in modern web apps.

An RSS 2.0 feed:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>DevToolbox Blog</title>
    <link>https://www.dev-toolbox.tech/blog</link>
    <description>Developer tools and tips</description>
    <item>
      <title>Understanding JSON Schema</title>
      <link>https://www.dev-toolbox.tech/blog/json-schema</link>
      <pubDate>Mon, 15 Jan 2024 09:00:00 GMT</pubDate>
      <description><![CDATA[
        <p>JSON Schema is a powerful tool for validating...</p>
      ]]></description>
    </item>
    <item>
      <title>XML vs JSON: When to Use Each</title>
      <link>https://www.dev-toolbox.tech/blog/xml-vs-json</link>
      <pubDate>Wed, 10 Jan 2024 14:30:00 GMT</pubDate>
      <description>A practical comparison of XML and JSON formats.</description>
    </item>
  </channel>
</rss>

Converted to JSON:

{
  "title": "DevToolbox Blog",
  "link": "https://www.dev-toolbox.tech/blog",
  "description": "Developer tools and tips",
  "items": [
    {
      "title": "Understanding JSON Schema",
      "link": "https://www.dev-toolbox.tech/blog/json-schema",
      "pubDate": "Mon, 15 Jan 2024 09:00:00 GMT",
      "description": "<p>JSON Schema is a powerful tool for validating...</p>"
    },
    {
      "title": "XML vs JSON: When to Use Each",
      "link": "https://www.dev-toolbox.tech/blog/xml-vs-json",
      "pubDate": "Wed, 10 Jan 2024 14:30:00 GMT",
      "description": "A practical comparison of XML and JSON formats."
    }
  ]
}

Key conversion considerations:

  1. CDATA descriptions become plain strings. The CDATA wrapper is stripped, and the HTML content is preserved as a JSON string value.
  2. Repeated <item> elements become a JSON array. This is the standard treatment for repeated sibling elements.
  3. Date formats. RSS uses RFC 822 dates (Mon, 15 Jan 2024 09:00:00 GMT). Consider normalizing to ISO 8601 for JSON output.
  4. Channel metadata is flattened. The <channel> wrapper is often stripped, promoting its children to the top level.

RSS vs. Atom vs. JSON Feed:

Format Base Typical use
RSS 2.0 XML Blogs, podcasts
Atom 1.0 XML More structured, IETF standard
JSON Feed JSON Modern alternative, native JSON

The JSON Feed specification provides a standard JSON structure for feeds, making it an ideal target format when converting RSS/Atom to JSON.

Use Case

Building a feed aggregator that fetches RSS feeds from multiple tech blogs, converts them to a unified JSON structure, and renders the combined feed in a React-based news reader application.

Try It — JSON ↔ XML Converter

Open full tool