$.getJSON("https://www.googleapis.com/freebase/v1/search?query=us%20president&filter=(all%20type:/people/person)&output=(/common/topic/image)", function (data) {
var r = data.result;
// iterate each result
$.each(r, function (i, j) {
var arr = j.output['/common/topic/image'];
//iterate each arr['/common/topic/image']
$.each(arr['/common/topic/image'], function (k, l) {
console.log(l);
});
});
});
See JSFiddle
From your comments,
If you check your json, last result has no array called /common/topic/image.
So when it tried to iterate, it failed[Unable to get the length].
So just add an condition to it like if (arr['/common/topic/image']) {...}. Now if it has empty element it will be skipped.
Check this fiddle http://jsfiddle.net/praveen_jegan/6MCKA/2/