HI Folks,
Can anyone please tell me how I can loop through the items and display each value?
Here is my json:
http://api.brightcove.com/services/library?command=find_all_videos&video_fields=renditions&token=ZpwKJFMptqRXV-rtn5ZAuWfUYHgnHOQLmHltN90f9WZ7pde7raxS2w..&callback=response&noCacheIE=1373013911514
I have this code so far, but nothing is outputted and no errors are generated.
for (var i = 0; i < jsonData.length; i++) {
alert(jsonData.d[0].frameWidth);
}
Indeed, that wouldn’t work because the JSON object contains an array of 100 items instead.
Looking at the JSON that’s returned, I’d say you need to do something like this:
for (var i = 0; i < jsonData.items.length; i++) {
var renditions = jsonData.items[i].renditions;
for (var j = 0; j < renditions.length; j++) {
console.log(renditions[j].frameWidth);
}
}