Mapping RSS and Atom to JSON Feed
Though RSS and Atom are XML and JSON Feed isn’t, there are a number of similarities. Here’s how to map them.
RSS
Channel
While RSS has a channel top-level element, JSON Feed puts the corresponding information at the top level.
RSS
titleanddescriptionmap directly to JSON. An RSSlinkmaps tohome_page_url.cloudelement is similar in purpose to the JSON Feedhubsitem.RSS has
webmasterandmanagingEditoritems, while JSON Feed has anauthoritem.imageis superficially like a JSON Feedicon— except that the JSON Feed version should be square, and the RSS image should be wider than it is tall. These map only in the case that your RSS image is already square.
Item
RSS has an array of item objects, and so does JSON Feed.
titlemaps directly, with the caveat that it must be plain text in JSON Feed. (Note:titleis optional in both RSS and JSON Feed.)linkmaps tourland toexternal_url. Theurlmust be a permalink, a link to the content of the item. When an item links to another page — as in a linkblog — thenexternal_urlmust be the URL of that other page. (See the Daring Fireball JSON feed for an example.)descriptionmaps tocontent_htmland tocontent_text. Choose the one that fits. A Twitter-like service might usecontext_text, while a blog might usecontent_html.guidmaps toid. In RSS,guidcan have anisPermaLinkattribute; in JSON Feed theurlmust be the permalink, andidmay be the same asurl, though it doesn’t have to be.The
authorelement is a single value, while in JSON Feed it’s an object withname,url, andavatarvalues.pubDatemaps todate_published, but this date and others in JSON Feed use a different format, the RFC 3339 format. (Example:2010-02-07T14:04:00-05:00.)enclosuremaps toattachments— but JSON Feed allows for multiple attachments. An RSSenclosurehas attributesurl,length, andtype, and the JSON Feed attachment object has corresponding elementsurl,size_in_bytes, andmime_type. JSON Feed addstitleandduration_in_seconds.categorymaps totags. In RSS acategorycan have adomainattribute, and there’s no equivalent in JSON Feed.
Atom
Feed
Unlike RSS’s channel element, Atom puts many of the elements to describe a feed at the top level of the document, just like JSON Feed.
Atom’s
titlemaps directly to JSON Feed.Atom uses
linkelements to show the relationship between the feed and other URLs. Without arelattribute, or withrel="alternate", Atom’slinkis equivalent to JSON Feed’shome_page_url. Withrel="self", it maps to JSON Feed’sfeed_url.Atom has
subtitleandidelements. There is no mapping for these in JSON Feed, althoughdescriptionin JSON could be used instead ofsubtitle.For WebSub, Atom uses
linkelements withrel="hub". JSON Feed has a dedicatedhubsarray.
Entry
Atom has an array of entry objects. In JSON Feed these are item objects.
Atom’s
title,id, andsummarymap directly to JSON. In JSON, however,titleandsummaryare always plain text.Atom uses a content’s
typeattribute to declare whether the text is plain text or HTML.type="html"ortype="xhtml"in an Atom feed maps tocontent_htmlin JSON.type="text"maps tocontent_textin JSON.linkwithrel="alternate"maps tourlin JSON. Ifrel="related"is used for links to an external site, in JSON Feed those map toexternal_url.The
authorelement containsname,uri, andemail, while in JSON Feed it’s an object withname,url, andavatarvalues.Atom’s
publishedandupdateddates map todate_publishedanddate_modifiedin JSON. Both Atom and JSON Feed use the same date format.Atom’s
linkwithrel="enclosure"maps toattachmentsin JSON Feed. An Atom enclosure has attributeshref,length, andtype, and the JSON Feed attachment object has corresponding elementsurl,size_in_bytes, andmime_type. JSON Feed addstitleandduration_in_seconds.
