On JSONfeed

I love it when people link to their RSS feed and it’s actually Atom.

I love it when people link to their RSS feed and it’s actually Atom.

There’s a new alternative to RSS and Atom called JSON Feed. It’s like RSS except that it uses JSON instead of XML. Having written a couple of RSS parsers in my life, I reckon this is a good idea: in many programming languages, parsing and producing XML is a huge hassle compared to dealing with JSON. If you try to consume random RSS feeds, you’ll quickly discover how broken they are.

Based on my experience, it’s common to produce XML by concatenating strings or using a string-based templating language. It’s also common to get this slightly wrong – the content is poorly escaped or the tags are mismatched. In contrast, especially in dynamic languages, JSON is easy to produce by serializing a datastructure. This means that coders in hurry are more likely to produce syntactically valid JSON than syntactically valid XML.

Caveat lector: I do not have experience in consuming random JSON files. My picture might be way too rosy.

The IndieWeb wiki offers some criticism of feed files. I subscribe to approximately 200 blogs and the point about feeds becoming out of date or broken is valid. Feeds just mysteriously break even though the HTML version of the blog continues to work. Sometimes people relocate their feeds without setting up a redirect. The trouble is that the publishers never notice because they don’t read their own feeds. It’s up to the reader to let them know.

A new feed format won’t fix this problem, but then again, I don’t know what would fix it.

I have yet to create a JSON feed for quanttype, but I might as well do it. If someone creates a JSON feed module for Hakyll, let me know.


Comments or questions? Tweet to me or send me an e-mail.