jquery - Can't access json object with javascript -


this question has answer here:

i know noob question i'm new json... cant access object data:

    {  "kind": "youtube#channellistresponse",  "etag": "\"y3xtlff3rlthxx85jbgzzgp2enw/7zzjjc0n0xtk8orpczfx2o9vpg8\"",  "pageinfo": {   "totalresults": 1,   "resultsperpage": 1  },  "items": [   {    "kind": "youtube#channel",    "etag": "\"y3xtlff3rlthxx85jbgzzgp2enw/_ucwu9q9vcvkwgxg_6vl636qcvu\"",    "id": "ucswgmafwouyvwr8z30n5qlq",    "snippet": {     "title": "chriscodex",     "description": "channel features: wateva\r\n-music\r\n-gaming\r\n-comedy\r\nsubscribe stay tune!\r\n\r\nfun fact, haters out there:\r\n\r\nbeing xbox fan isn't wrong hope you're being sarcastic , realize that's myth evolved peoples' insistance on proving getting money's worth xbl.\r\nthe \"online connection\" determined solely personal internet speeds. in other words has nothing console play.",     "publishedat": "2011-08-09t02:23:58.000z",     "thumbnails": {      "default": {       "url": "https://yt3.ggpht.com/-ul6vyobij08/aaaaaaaaaai/aaaaaaaaaaa/y4osglkvucw/s88-c-k-no/photo.jpg"      },      "medium": {       "url": "https://yt3.ggpht.com/-ul6vyobij08/aaaaaaaaaai/aaaaaaaaaaa/y4osglkvucw/s240-c-k-no/photo.jpg"      },      "high": {       "url": "https://yt3.ggpht.com/-ul6vyobij08/aaaaaaaaaai/aaaaaaaaaaa/y4osglkvucw/s240-c-k-no/photo.jpg"      }     },     "localized": {      "title": "chriscodex",      "description": "channel features: wateva\r\n-music\r\n-gaming\r\n-comedy\r\nsubscribe stay tune!\r\n\r\nfun fact, haters out there:\r\n\r\nbeing xbox fan isn't wrong hope you're being sarcastic , realize that's myth evolved peoples' insistance on proving getting money's worth xbl.\r\nthe \"online connection\" determined solely personal internet speeds. in other words has nothing console play."     }    }   }  ] } 

how value thumbnails default url?

i tried

$-getjson(url, function(data){ var url = data.items.snippet.thumbnails.default.url; }); 

but error typeerror: data.items[0].snippet.thumbnail undefined

the items property in object array, have define index when accessing it:

data.items[0].snippet.thumbnails.default.url 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -