Blog2007 ≫ New JSON feed of my blog

Some javascript messing about

Oh that'll come in handy1 for all those mashups based around me you've been planning... Not a straight feed of what I post every day, it searches the content of the site, probably seven or eight years worth of postings now.

JSON is "javascript object notation" btw (if you have no interest in javascript best stop reading now), presenting information in such a format you can slot it straight into a script without any more processing needed. XML is great for passing info around the web, except that AJAX requests specifically block you from fetching XML from another website, but you can call javascript from anywhere happily.

It works in the same way as the xml feeds2, construct your call to my JSON API (ooh, get me) like this:

http://www.clarkeology.com/javascript/_your-callback-goes-here_/squirrel+and+magpie.js

3

And that'll return something like:

callback-goes-here( [{guid:10701,
    link:"/m/10701",
    title:"New JSON feed of my blog",
    description:"Oh that\'ll come in handy for all those mashups based around me you\'ve been planning... Not a straigh",
    category:["javascript",
      "json",
      "feed",
      "xml"],
    geo:{lat:51.0800,
      lon:1.1645}},
  {guid:10278,
    link:"/m/10278",
    title:"Mods and rockers all over again",
    description:"Yesterday I saw a turf war in Folkestone, a ferocious battle between six magpies and three squirrels",
    geo:{lat:51.0800,
      lon:1.1645}},
  {guid:63,
    link:"/m/63",
    title:"arcade games",
    description:"Walked the long way round Listria Park on the way to Church Street today, and saw two magpies and a",
    geo:{lat:51.0800,
      lon:1.1645}}] )

Hmm, will reformat that later so it looks nicer here (don't know where all those backslashes came from, they're not there in the real json4, and also I should investigate if there is an rss style standard for json blog feed5, it's all very well me saying "my blog titles are called mSubject" but if no-one else is using that it's not really going to catch on for blogs... If you don't know what that is, then just come back later, I'm sure to post something about squirrels again soon.

To use these feeds of mine, you want to put some javascript on your page that grabs that feed and does something with it. If you're using the newer version of jquery.com6 say, you can whack some of my content into your page like this:

// removed code

I'm doing that on http://yourfolkestone.com

Will be extending this to cover other content soon, ie a list of pubs local to a particular postcode or something like that, won't that be nice?

javascript: Programming language of the web, mostly how I make my living.

💬 RE: New JSON feed of my blog - 10715

⬅️ :: ➡️

Paul Clarke's blog - I live in Hythe near Folkestone. Wed to Clare + dad to two, I'm a full stack web developr, + I do mostly javascript / nodejs, some ruby, python, php ect ect. I like pubbing, parkrun, eating, home automation and other diy jiggery-pokery, history, tree stuff, Television, squirrels, pirates, lego, and TIME TRAVEL.