javascript - Read array in JSON object -
javascript - Read array in JSON object -
i trying read next json:
{ "items":[ { "snippet":{ "title":"pharrell williams - happy (12am)", "categoryid":"10" }, "topicdetails":{ "topicids":[ "/m/04mn81", "/m/0zdjzxm" ] } } ] }
i've read topicids
json. i've tried next read topicids doesn't work. please tell me what's wrong here:
$.each(jsonresponse.items,function(key, value){ $.each(value.topicdetails,function(k,v){ for(var i=0, len = k.length; i< len; i++){ alert(v[i]); } }); }); }
it says there no property `length'.
read this:
$.each(data.items, function(key, value) { $.each(value.topicdetails.topicids, function(k, v) { console.log(k, v); }); });
fiddle
javascript jquery json youtube-api youtube-javascript-api
Comments
Post a Comment