Can I serve RSS in JSON?
I believe this has been done already.
Take a look at this jQuery extension: jFeed - RSS/ATOM feed parser
jQuery.getFeed(options);
Options:
- url:
- data:
- success:
Example:
jQuery.getFeed({
url: 'rss.xml',
success: function(feed) {
alert(feed.title);
}
});
Note that in this case, 'feed' would be a javascript object. If you wanted to pass this using JSON, you can just use the javascript JSON utility.
Example:
var myJSONText = JSON.stringify(feed);
Is the RSS spec (sans the XML part) a useful spec to conform to in this case?
If you want to invent yet another syndication format, I recommend using Atom as a base. IMHO it has much cleaner, more consistent design, and has useful features like reliable updates of past items, makes distinction between summaries and full content, etc.
I was wondering if this had been done already.
Flickr has JSON output format. They even have lolcode feed.
No, RSS is an XML-based format, and JSON is an different language rather than some kind of dialect. RSS readers won't understand JSON.
Your question is akin to asking 'Can I speak French in Chinese?'
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.