For most developers, JSON is far easier to read and write than XML. Developers may groan at picking up an XML parser, but decoding JSON is often just a single line of code.
Our hope is that, because of the lightness of JSON and simplicity of the JSON Feed format, developers will be more attracted to developing for the open web.
There are obvious benefits to adopting JSON Feed over something less modern like RSS/Atom. However, new standards (at least, initially) suffer from the chicken-and-egg problem: feed reader developers have little incentive to support the new JSON Feed format because so few publishers adopt it, while publishers have little incentive to adopt a new format because so few feed readers support it. Not to mention, publishers already have a working solution (RSS/Atom). In this case, I think publishers need to drive this change and eventually feed readers will follow. The good news is that — like Brent and Manton so clearly articulate — it’s easy and fun to work with JSON.
JSON Feed and Jekyll
This site is built using Jekyll, so supporting JSON Feed just requires adding a new template
feed.json file in the root directory of your site. It’s the same as supporting RSS/Atom, where you provide a
feed.xml template. Your site configuration will vary, but your
feed.json should be similar to mine. Here it is. You fill-in your site metadata, and iterate through each post to build an array of items. You’ll notice that it’s very similar to the feed.xml for RSS/Atom.
Then, you’ll need to add a
<link /> tag in the
<head> section of your site:
That’s all. When you run
jekyll build, your full feed will be generated. Now, go add JSON Feed support to your blog, too.