Delving into JSON feeds

Developing my latest JSON-based widgets
was done with a lot of trial and error, without a good understanding of
the JSON-format and lacking knowledge of how to access the feed and
retrieve the data. So this weekend I did some research and developed a
small javascript program to analyze the feeds. It is tech stuff, so
don't worry if you don't understand it.

I found some documentation on the JSON-feed format, based on Google Calendar. A little later I discovered a simple tutorial on how to browse through JSON objects.

I
changed this into a recursive javascript function, that browses the
complete JSON-feed-tree, and displays all keys and all values. You can
use is to research any JSON-feed.

Create a simple HTML-page, using the following code.

<html>
<head>
<script type='text/javascript'>
function listkeys(feedobj,depth) {
for (key in feedobj) {
for (var i=0; i<depth; i++) document.write('- ');
document.write(key+' = '+feedobj[key]+'<br/>');
listkeys(feedobj[key],depth+1);}
}

function showfeedcontent(json) {
listkeys(json,0);
}</script>
</head>
<body>
JSON FEED PARSER
<br/><br/>
<script src="http://beautifulbeta.blogspot.com/feeds/posts/default?alt=json-in-
script&callback=showfeedcontent"></script>
</body>
</html>


In this code replace the beautifulbeta.blogspot.com feed reference to your own blog's feed.

Open the HTML-page in your browser, and the complete feed will be displayed.
Related Posts Plugin for WordPress, Blogger...