JSON Feed Is Cool (+ a Simple Tool to Create Your Own)
What JSON Feed is, why we're so excited about it, and a simple tool to help you create your own.
A few months ago, Manton Reece and Brent Simmons announced the creation of JSON Feed, a new JSON-based syndication format similar to (but so much better than) RSS and Atom. One might reasonably contend that Google killed feed-based content aggregation in 2013 when they end-of-lifed™ Google Reader, but RSS continues to enjoy underground popularity and JSON Feed has the potential to make feed creation and consumption even more widespread. So why are we1 so excited about it?
JSON > XML
RSS and Atom are both XML-based formats, and as someone who’s written code to both produce and ingest these feeds, it’s not how I’d choose to spend a Saturday. Or even a Tuesday. Elements in XML have both attributes and children, which is a mismatch for most modern languages’ native data structures. You end up having to use libraries like Nokogiri to write code like item.attributes["name"]
and item.children[0]
. And producing a feed usually involves a full-blown templating solution like ERB. Contrast that with JSON, which maps perfectly to JavaScript objects (-_-), Ruby hashes/arrays, Elixir maps, etc., etc. Producing a feed becomes a call to .to_json
, and consuming one,
JSON.parse
.
Flexibility
While still largely focused on content syndication, the spec includes support for plaintext and title-less posts and custom extensions, meaning its potential uses are myriad. Imagine a new generation of microblogs, Slack bots, and IoT devices consuming and/or producing JSON feeds.
Feeds Are (Still) Cool
Not to get too high up on my horse or whatever, but as a longtime web nerd, I’m dismayed by how much content creation has migrated to walled gardens like Facebook/Instagram/Twitter/Medium that make it super easy to get content in, but very difficult to get it back out. Twitter killed RSS in 2012, and have you ever tried to get a list of your most recent Instagram photos programatically? I wouldn’t. Owning your own content and sharing it liberally is what the web was made for, and JSON Feed has the potential to make it easy and fun to do. It’s how things should be. It’s how they could be.
Your Turn
If this sounds at all interesting to you, read the announcement and the spec, listen to this interview with the creators, and try out this JSON Feed Validator I put up this week. You can use the Daring Fireball feed or create your own. It’s pretty simple right now, running your input against a schema I downloaded from JSON Schema Store, but suggestions and pull requests are welcome.