Feeds JSON-LD

The other day I was looking into using feeds in JSON-LD and I couldn’t find anything off the shelf:

  1. RSS/ATOM are awesome, but XML.
  2. http://schema.org/DataFeed can get into JSON-LD, but is incomplete compared to RSS/ATOM.
  3. http://jsonfeed.org is JSON, but neither JSON-LD nor a perfect mapping to RSS/ATOM (e.g. re-invents it).

Ideally, I’d find something that reused as much as possible the hard work put into figuring the semantics of RSS/ATOM (as well as things like tooling, documentation, test of time, etc) but could be embedded in JSON-LD.

Here is what I’m generally looking for and here is an example of what that would look like for this website.

WDYT?

Example

{
  "@context": "http://www.w3.org/2005/Atom",
  "@type": "Feed",
  "title": "Example Feed",
  "subtitle": "A subtitle.",
  "links": [{
      "@type": "Link",
      "href": "http://example.org/feed/",
      "rel": "self"
    }, {
      "@type": "Link",
      "href": "http://example.org/"
  }],
  "id": "urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6",
  "updated": "2003-12-13T18:30:02Z",
  "entries": [{
      "title": "Atom-Powered Robots Run Amok",
      "links": [{
          "@type": "Link",
          "href": "http://example.org/2003/12/13/atom03"
        }, {
          "@type": "Link",
          "rel": "alternate",
          "type": "text/html",
          "href": "http://example.org/2003/12/13/atom03.html"
        }, {
          "@type": "Link",
          "rel": "edit",
          "href": "http://example.org/2003/12/13/atom03/edit"
      }],
      "id": "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a",
      "updated": "2003-12-13T18:30:02Z",
      "summary": "Some text.",
      "content": {
        "type": "xhtml",
        "value": ""
      },
      "author": {
        "name": "John Doe",
        "email": "johndoe@example.com"
      }
    }
  ]
}

Extensions

One of the pretty awesome parts of XML is how extensible it is. JSON-LD, thankfully, has built-in extensibility points that are pretty awesome too.

Here is what podcasts could look like in RSS/ATOM in JSON-LD:

{
  "@context": "http://www.w3.org/2005/Atom",
  "@type": "Feed",
  "title": "Example Feed",
  "subtitle": "A subtitle.",
  "entries": [{
      "title": "Atom-Powered Robots Run Amok",
      "summary": "Some text.",
      "content": {
        "@context": "https://schema.org",
        "@type": "Product",
        "name": "Tide",
        "description": "The best detergent ever!"
      }
    }
  ]
}

Related Work