Skip to content


Repository files navigation


npm version build status downloads js-standard-style

Convert a JSON feed to an atom feed.

JSON feed icon


$ npm install jsonfeed-to-atom


const jsonfeedToAtom = require('jsonfeed-to-atom')
const someJSONFeed = require('./load-some-json-feed-data.json')

const atomFeed = jsonfeedToAtom(someJSONFeed) // Returns an atom formatted json feed

Example input:

 "version": "",
 "title": " log",
 "home_page_url": "",
 "feed_url": "",
 "description": "A running log of announcements, projects and accomplishments.",
 "next_url": "",
 "icon": "",
 "author": {
  "name": "Bret Comnes",
  "url": "",
  "avatar": ""
 "items": [
   "date_published": "2018-04-07T20:48:02.000Z",
   "content_text": "Wee wooo this is some content. \n Maybe a new paragraph too",
   "url": "",
   "id": ""
   "date_published": "2018-04-07T22:06:43.000Z",
   "content_html": "<p>Hello, world!</p>",
   "title": "This is a blog title",
   "url": "",
   "external_url": "",
   "id": ""

Example output:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="">
  <title> log</title>
  <link rel="self" type="application/atom+xml" href=""/>
  <link rel="alternate" type="application/json" href=""/>
  <link rel="alternate" type="text/html" href=""/>
  <link rel="next" href=""/>
    <name>Bret Comnes</name>
  <generator uri="" version="1.0.0">jsonfeed-to-atom</generator>
  <rights>© 2018 Bret Comnes</rights>
  <subtitle>A running log of announcements, projects and accomplishments.</subtitle>
    <title>Wee wooo this is some content.</title>
    <content type="text">Wee wooo this is some content.
 Maybe a new paragraph too</content>
    <link rel="alternate" href=""/>
    <title>This is a blog title</title>
    <content type="html">
      <![CDATA[<p>Hello, world!</p>]]>
    <link rel="alternate" href=""/>
    <link rel="related" href=""/>


jsonfeedToAtom(parsedJsonfeed, opts)

Coverts a parsed JSON feed into an atom feed. Returns the string of the atom feed.

Opts include:

  // a function that returns the atom feed url
  feedURLFn: (feedURL, jf) => feedURL.replace(/\.json\b/, '.xml')

See also