Recover Json Value

0

I'm including my YouTube channel with my videos on my site. But there's a part of Json that I can not recover.

I'm doing this:

$.each($feed.items, function(i,item){
var url = item.videoId;

I commented on the code for you to see from Json. But it's coming undefined .

{
 "kind": "youtube#searchListResponse",
 "etag": "\"***/***"",
 "nextPageToken": "CAUQAA",
 "pageInfo": {
  "totalResults": 9,
  "resultsPerPage": 5
 },
 "items": [
  {
   "kind": "youtube#searchResult",
   "etag": "\"***/***"",
   "id": {
    "kind": "youtube#video",
    "videoId": "*************" ############################## AQUI
   },
   "snippet": {
    "publishedAt": "2015-05-26T17:47:49.000Z",
    "channelId": "****",
    "title": "TITULO",
    "description": "",
    "thumbnails": {
     "default": {
      "url": "default.jpg"
     },
     "medium": {
      "url": "qdefault.jpg"
     },
     "high": {
      "url": "hqdefault.jpg"
     }
    },
    "channelTitle": "TESTE",
    "liveBroadcastContent": "none"
   }
  },
    
asked by anonymous 26.05.2015 / 21:27

1 answer

1

I solved the question. Although this above Json is returned by the direct URL in the browser, I opened my Inspect Element and gave console.log(item) within the Each() function.

Then he showed me:

Object = Item {
   id : {
      videoId: *****
   }
}

Then I made a item.id.videoId and it worked cool.

Thank you.

    
26.05.2015 / 21:45