Reading RSS and Atom feeds as JSON
Convert RSS and Atom feeds to JSON you can work with: the channel and entry structure, the single-item array trap and the date and HTML fields that trip people up.
Quick Answer
RSS and Atom are XML, so converting RSS to JSON uses the same rules as any XML document. The specifics that matter are the channel-and-item structure, the array trap when a feed has a single item, date fields that stay strings and description fields that contain escaped HTML you must not double-unescape.
Search Snapshot
- Format
- Engineering
- Reading time
- 5 min
- Last updated
- June 12, 2026
- Primary topic
- RSS to JSON
- Intent
- informational
Key Takeaways
Point 1
RSS items and Atom entries are repeated tags, so normalise them to a JSON array even when there is only one.
Point 2
Feed dates convert to strings; parse them in your code rather than expecting a date type.
Point 3
Description and content fields often hold escaped HTML—decode once, and never inject it without sanitising.
RSS and Atom power newsreaders, podcast clients, content dashboards and countless internal alerting tools. They are both XML under the hood, which means turning a feed into something a JavaScript app can use is really just XML to JSON conversion with a few feed-specific wrinkles. If you have read the rest of this series the mechanics will feel familiar—this piece focuses on the parts unique to feeds.
The shape of a feed
An RSS feed nests its posts as item elements inside a channel. An Atom feed nests them as entry elements inside a feed. Convert RSS to JSON and you get a channel object with feed-level metadata—title, link, description—plus the items. Atom gives you the same idea with different names. The practical move is to drill to item or entry and treat that as your array of posts, ignoring the wrapper metadata unless you need it. Paste a real feed into the XML to JSON converter and the structure is immediately obvious.
The single-item array trap
This is the bug that bites every feed reader eventually. A tag becomes a JSON array only when it appears more than once, so a feed with five items gives you an array of five, but a feed with one item gives you a single object. Code that loops over items will throw the day a slow news cycle leaves a feed with exactly one post. Always normalise item or entry to an array in your consumer—coerce a lone object into a one-element array—so the quiet days behave like the busy ones. The general version of this rule lives in how XML maps to JSON.
Dates stay strings
Feeds carry publication dates—pubDate in RSS, published and updated in Atom—and these convert to strings, because JSON has no date type. That is correct and lossless, but it means you parse them yourself. RSS tends to use one date convention and Atom another, so a reader that ingests both should detect and normalise to a single representation rather than assuming one format. Keep the raw string too if you ever need to display exactly what the publisher sent.
Description and content are HTML
The field people get wrong is the body. RSS description and Atom content fields frequently contain HTML that has been escaped into entities so it survives inside XML. The converter decodes that once into real markup. Two things follow. First, do not unescape it again—double-decoding mangles ampersands and breaks links. Second, treat the markup as untrusted: a feed is external input, so sanitise before you render it, or a hostile feed can inject script into your page. This is a security boundary, not a formatting nicety.
RSS and Atom side by side
| Concept | RSS | Atom |
|---|---|---|
| Feed wrapper | channel | feed |
| A post | item | entry |
| Publish date | pubDate | published |
| Last change | — | updated |
| Body | description | content |
| Link | link (text) | link (href attribute) |
The same concepts under different names—map both to one JSON shape.
A reliable feed-to-JSON routine
- Fetch the feed and convert it with the XML to JSON converter.
- Drill to
channel.item(RSS) orfeed.entry(Atom) and force it to an array. - Map each post to a flat shape—title, link, date, summary—so the rest of your app does not care whether the source was RSS or Atom.
- Parse dates into one representation and sanitise any HTML body.
- Confirm the result with the JSON validator, and compare two pulls with JSON diff when debugging a flaky publisher.
Where this fits in the series
Feeds and SOAP are the two XML sources you will most often convert—see turning SOAP XML into JSON for the other one. For the underlying rules, read how XML maps to JSON. For the wider format trade-offs start at XML vs JSON: the practical differences.
Frequently asked questions
What is the difference between RSS and Atom for conversion?
The mechanics are identical because both are XML. Only the structure differs—RSS uses channel and item, Atom uses feed and entry. Map item or entry to an array and both normalise to the same shape.
Why does my feed sometimes return one item as an object?
A tag becomes an array only when it repeats. A single-item feed produces a single object, so always coerce to an array in your code.
Bottom line
Converting RSS to JSON is ordinary XML to JSON conversion plus three feed habits: normalise items to an array, parse the date strings yourself and sanitise the HTML bodies. Get those right and you can read any feed as clean JSON your app will actually enjoy consuming.
Get new playbooks weekly
Actionable guides, market updates and shipping notes — once a week.