xmljsonrss

Can I serve RSS in JSON?


I am writing an RSS feed (for fun) and was looking at the spec here.

RSS is a dialect of XML. All RSS files must conform to the XML 1.0 specification, as published on the World Wide Web Consortium (W3C) website.

Obviously this means that I am not serving 'pure' RSS if I choose the JSON option. That said, if I conform to the rest of the spec, is it likely that (customised) readers will be able to parse it?

To put it another way, if I conform to the spec, but using JSON instead of XML is it a usable RSS feed?

edit I am not sure I made myself clear. There is no XML involved. I want to write something akin to RSS (which is XML) using JSON instead. Obviously the readers of such a feed would need to be written to understand the JSON format. I was wondering if this had been done already. Are there services that serve a feed this way? Are there programs that can aggregate/understand this format. Is the RSS spec (sans the XML part) a useful spec to conform to in this case?

rg

{
"title":"example.com",
"link":"http://www.example.com/",
"description":"Awesome news about junk",
"items":[
    {
        "title":"An article",
        "link":"http://www.example.com/an-article",
        "descrition":"Some sample text here",
        "pubDate":"2008-10-27 11:06 EST",
        "author":"example author",
    },
    {
        "title":"Second",
        "link":"http://www.example.com/Seond",
        "descrition":"Some sample text here",
        "pubDate":"2008-10-25 23:20 EST",
        "author":"author mcauthor",
    },
    {
        "title":"third article",
        "link":"http://www.example.com/third-article",
        "descrition":"Some sample text here",
        "pubDate":"2008-10-25 23:18 EST",
        "author":"some other author",
    }
]
} 

Solution

  • You're right that the client reading the feed would have to have custom support for whatever the particulars of your JSON were. So you'd either need to make a custom feed reader to consume that information, or someone would have to propose a JSON feed standard, and it'd have to be widely adopted.

    Well, I think your desires have finally been met, friend!

    Take a look at JSON Feed. As of this writing it's only about a week old, but it's already picking up steam, having been supported now by Feedly, Feedbin, News Explorer, NewsBlur, and more being added all the time.

    If I had to pick a standard to use when generating a JSON version of RSS, I'd pick JSON Feed for sure.