I'm working on a JavaScript dynamically loaded tree view user control. I'd like to test it with real world data.
Does anybody know any public service with an API that provides access to hierarchical data in JSON format?
This question is related to
javascript
json
testing
treeview
Tumblr has a public API that provides JSON. You can get a dump of posts using a simple url like http://puppygifs.tumblr.com/api/read/json
.
The Tumbler V2 API provides a pure JSON response but requires jumping through a few hoops:
Example URL: http://api.tumblr.com/v2/blog/puppygifs.tumblr.com/posts/photo?api_key=YOUR_KEY_HERE
Result showing tree structure in Fiddler:
Found one from Flickr that doesn't need registration / api.
Basic sample, Fiddle: http://jsfiddle.net/Braulio/vDr36/
More info: post
Pasted sample
HTML
<div id="images">
</div>
Javascript
// Querystring, "tags" search term, comma delimited
var query = "http://www.flickr.com/services/feeds/photos_public.gne?tags=soccer&format=json&jsoncallback=?";
// This function is called once the call is satisfied
// http://stackoverflow.com/questions/13854250/understanding-cross-domain-xhr-and-xml-data
var mycallback = function (data) {
// Start putting together the HTML string
var htmlString = "";
// Now start cycling through our array of Flickr photo details
$.each(data.items, function(i,item){
// I only want the ickle square thumbnails
var sourceSquare = (item.media.m).replace("_m.jpg", "_s.jpg");
// Here's where we piece together the HTML
htmlString += '<li><a href="' + item.link + '" target="_blank">';
htmlString += '<img title="' + item.title + '" src="' + sourceSquare;
htmlString += '" alt="'; htmlString += item.title + '" />';
htmlString += '</a></li>';
});
// Pop our HTML in the #images DIV
$('#images').html(htmlString);
};
// Ajax call to retrieve data
$.getJSON(query, mycallback);
Another very interesting is Star Wars Rest API:
Source: Stackoverflow.com