JSON feed

The JSON feed format is a pragmatic syndication format, like RSS and Atom, but with one big difference: it’s JSON instead of XML.

To expose a JSON feed on your site, add a new view to your template and paste in the following code. Warning: If you have an existing view called feed.rss or feed.xml, please name your JSON feed something other than feed.json. There’s an obscure bug which I will fix soon that is triggered when two template views share the same name, even if they have different extensions.

You can verify your feed is correctly formed using the JSON feed validator.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{ 
  "version": "https://jsonfeed.org/version/1",
  "title": "{{#encodeJSON}}{{{title}}}{{/encodeJSON}}",
  "description": "{{#encodeJSON}}Feed for {{{title}}}{{/encodeJSON}}",
  "home_page_url": "{{{blogURL}}}",
  "feed_url": "{{{blogURL}}}/jsonfeed.json",
  "items": [
    {{#recentEntries}}
    { 
      "id": "{{{absoluteURL}}}",
      "title": "{{#encodeJSON}}{{{title}}}{{/encodeJSON}}",
      {{#summary}}
      "summary": "{{#encodeJSON}}{{{summary}}}{{/encodeJSON}}",
      {{/summary}}
      {{#thumbnail.large}}
      "image": "{{{blogURL}}}{{{url}}}",
      {{/thumbnail.large}}
      "content_html": "{{#encodeJSON}}{{#absoluteURLs}}{{{body}}}{{/absoluteURLs}}{{/encodeJSON}}",
      "date_published": "{{#formatDate}}YYYY-MM-DDTHH:mm:ssZ{{/formatDate}}",
      "url": "{{{absoluteURL}}}"
    }{{^last}},{{/last}}
    {{/recentEntries}}
  ]
}


Thanks to Amit Gawande and Jamie Thingelstad for their help with this guide. And thanks to Manton Reece and Brent Simmons for writing the JSON feed spec.