在我的谷歌搜索API调用中,它返回一个有效的JSON,但每当我解析它以获得特定值时,我都会得到Undefined

In my Google Search API call, It is returning a valid JSON, but whenever I parse it to get a specific value, I get Undefined

本文关键字:Undefined JSON 调用 返回 API 搜索 我的 谷歌 有效 一个      更新时间:2023-09-26

这是我从一个简单的Google Api搜索中收集的JSON我想获取第一个Url(https://www.facebook.com/Rashtriye-Goraksha-Sena-Appeal-Pls-Save-Mother-Cow-149271605156819/)不要问我为什么这是奶牛的第一个链接请哈哈

{
 "kind": "customsearch#search",
 "url": {
  "type": "application/json",
  "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
 },
 "queries": {
  "request": [
   {
    "title": "Google Custom Search - cow pls",
    "totalResults": "315000",
    "searchTerms": "cow pls",
    "count": 10,
    "startIndex": 1,
    "inputEncoding": "utf8",
    "outputEncoding": "utf8",
    "safe": "off",
    "cx": "002141288598133749978:zrk0yz6qoee"
   }
  ],
  "nextPage": [
   {
    "title": "Google Custom Search - cow pls",
    "totalResults": "315000",
    "searchTerms": "cow pls",
    "count": 10,
    "startIndex": 11,
    "inputEncoding": "utf8",
    "outputEncoding": "utf8",
    "safe": "off",
    "cx": "002141288598133749978:zrk0yz6qoee"
   }
  ]
 },
 "context": {
  "title": "Web"
 },
 "searchInformation": {
  "searchTime": 0.379396,
  "formattedSearchTime": "0.38",
  "totalResults": "315000",
  "formattedTotalResults": "315,000"
 },
 "items": [
  {
   "kind": "customsearch#result",
   "title": "Rashtriye Goraksha Sena Appeal Pls Save Mother Cow",
   "htmlTitle": "Rashtriye Goraksha Sena Appeal 'u003cb'u003ePls'u003c/b'u003e Save Mother 'u003cb'u003eCow'u003c/b'u003e",
   "link": "https://www.facebook.com/Rashtriye-Goraksha-Sena-Appeal-Pls-Save-Mother-Cow-149271605156819/",
   "displayLink": "www.facebook.com",
   "snippet": "Rashtriye Goraksha Sena Appeal Pls Save Mother Cow. 724 likes · 2 talking 'nabout this. SAVE THE MOTHER COW.",
   "htmlSnippet": "Rashtriye Goraksha Sena Appeal 'u003cb'u003ePls'u003c/b'u003e Save Mother 'u003cb'u003eCow'u003c/b'u003e. 724 likes · 2 talking 'u003cbr'u003e'nabout this. SAVE THE MOTHER 'u003cb'u003eCOW'u003c/b'u003e.",
   "cacheId": "Pohw6X7G3PkJ",
   "formattedUrl": "https://www.facebook.com/Rashtriye-Goraksha-Sena-Appeal-Pls-Save- Mother-Cow-149271605156819/",
   "htmlFormattedUrl": "https://www.facebook.com/Rashtriye-Goraksha-Sena-Appeal-'u003cb'u003ePls'u003c/b'u003e-Save- Mother-'u003cb'u003eCow'u003c/b'u003e-149271605156819/",
   "pagemap": {
    "organization": [
     {
      "name": "Rashtriye Goraksha Sena Appeal Pls Save Mother Cow"
     }
    ],
    "metatags": [
     {
      "referrer": "default",
      "al:android:app_name": "Facebook",
      "al:android:package": "com.facebook.katana",
      "al:android:url": "fb://page/149271605156819",
      "al:ios:app_name": "Facebook",
      "al:ios:app_store_id": "284882215",
      "al:ios:url": "fb://page/?id=149271605156819"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "ZOMBIE COW PLS | The Walking Dead | Season 1 Episode 2 ...",
   "htmlTitle": "ZOMBIE 'u003cb'u003eCOW PLS'u003c/b'u003e | The Walking Dead | Season 1 Episode 2 ...",
   "link": "https://www.youtube.com/watch?v=qU_rdIkbZps",
   "displayLink": "www.youtube.com",
   "snippet": "Aug 13, 2014 ... I really wanted that cow to go berserker... Enjoyed the video? Subscribe for 'nMOAR ▻  Wanna help me out? Share this video ...",
   "htmlSnippet": "Aug 13, 2014 'u003cb'u003e...'u003c/b'u003e I really wanted that 'u003cb'u003ecow'u003c/b'u003e to go berserker... Enjoyed the video? Subscribe for 'u003cbr'u003e'nMOAR Wanna help me out? Share this video ...",
   "cacheId": "01LPSjGh_ywJ",
   "formattedUrl": "https://www.youtube.com/watch?v=qU_rdIkbZps",
   "htmlFormattedUrl": "https://www.youtube.com/watch?v=qU_rdIkbZps",
   "pagemap": {
    "cse_thumbnail": [
     {
      "width": "259",
      "height": "194",
      "src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQX0jWyhHo39yHo1zttCkvsdK_0dS6wXOhww4ggSkTfFBtzC6zK-jWm4LQ"
     }
    ],
    "imageobject": [
     {
      "url": "https://i.ytimg.com/vi/qU_rdIkbZps/hqdefault.jpg",
      "width": "480",
      "height": "360"
     }
    ],
    "person": [
     {
      "url": "http://www.youtube.com/user/MikeEZMODE"
     },
     {
      "url": "https://plus.google.com/118244090717562293729"
     }
    ],
    "metatags": [
     {
      "title": "ZOMBIE COW PLS | The Walking Dead | Season 1 Episode 2 Walkthrough - Part 4",
      "theme-color": "#e62117",
      "og:site_name": "YouTube",
      "og:url": "https://www.youtube.com/watch?v=qU_rdIkbZps",
      "og:title": "ZOMBIE COW PLS | The Walking Dead | Season 1 Episode 2 Walkthrough - Part 4",
      "og:image": "https://i.ytimg.com/vi/qU_rdIkbZps/hqdefault.jpg",
      "og:description": "I really wanted that cow to go berserker... Enjoyed the video? Subscribe for MOAR ►  Wanna help me out? Share this video with your frie...",
      "al:ios:app_store_id": "544007664",
      "al:ios:app_name": "YouTube",
      "al:ios:url": "vnd.youtube://www.youtube.com/watch?v=qU_rdIkbZps&feature=applinks",
      "al:android:url": "vnd.youtube://www.youtube.com/watch?v=qU_rdIkbZps&feature=applinks",
      "al:android:app_name": "YouTube",
      "al:android:package": "com.google.android.youtube",
      "al:web:url": "https://www.youtube.com/watch?v=qU_rdIkbZps&feature=applinks",
      "og:type": "video",
      "og:video:url": "https://www.youtube.com/embed/qU_rdIkbZps",
      "og:video:secure_url": "https://www.youtube.com/embed/qU_rdIkbZps",
      "og:video:type": "text/html",
      "og:video:width": "1280",
      "og:video:height": "720",
      "og:video:tag": "mikeable",
      "fb:app_id": "87741124305",
      "twitter:card": "player",
      "twitter:site": "@youtube",
      "twitter:url": "https://www.youtube.com/watch?v=qU_rdIkbZps",
      "twitter:title": "ZOMBIE COW PLS | The Walking Dead | Season 1 Episode 2 Walkthrough - Part 4",
      "twitter:description": "I really wanted that cow to go berserker... Enjoyed the video? Subscribe for MOAR ► anna help me out? Share this video with your frie...",
      "twitter:image": "https://i.ytimg.com/vi/qU_rdIkbZps/hqdefault.jpg",
      "twitter:app:name:iphone": "YouTube",
      "twitter:app:id:iphone": "544007664",
      "twitter:app:name:ipad": "YouTube",
      "twitter:app:id:ipad": "544007664"
     }
    ],
    "videoobject": [
     {
      "url": "https://www.youtube.com/watch?v=qU_rdIkbZps",
      "name": "ZOMBIE COW PLS | The Walking Dead | Season 1 Episode 2 Walkthrough - Part 4",
      "description": "I really wanted that cow to go berserker... Enjoyed the video? Subscribe for MOAR ►  Wanna help me out? Share this video with your frie...",
      "paid": "False",
      "channelid": "UCkmdUmnMWoQnC5ERPM0lKhQ",
      "videoid": "qU_rdIkbZps",
      "duration": "PT14M53S",
      "unlisted": "False",
      "thumbnailurl": "https://i.ytimg.com/vi/qU_rdIkbZps/hqdefault.jpg",
      "embedurl": "https://www.youtube.com/embed/qU_rdIkbZps",
      "playertype": "HTML5 Flash",
      "width": "1280",
      "height": "720",
      "isfamilyfriendly": "True",
      "regionsallowed": "AD,AE,AF,AG,AI,AL,AM,AO,AQ,AR,AS,AT,AU,AW,AX,AZ,BA,BB,BD,BE,BF,BG,BH,BI,BJ,BL,BM,BN,BO,BQ,BR,BS,BT,BV,BW,BY,BZ,CA,CC,CD,CF,CG,CH,CI,CK,CL,CM,CN,CO,CR,CU,CV,CW,CX,CY,CZ,DE,DJ,DK,DM,DO,DZ,EC,EE,EG,EH...",
      "interactioncount": "396",
      "datepublished": "2014-08-13",
      "genre": "Gaming"
     }
    ],
    "cse_image": [
     {
      "src": "https://i.ytimg.com/vi/qU_rdIkbZps/hqdefault.jpg"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Rashtriye Goraksha Sena Appeal Pls Save Mother Cow | Facebook",
   "htmlTitle": "Rashtriye Goraksha Sena Appeal 'u003cb'u003ePls'u003c/b'u003e Save Mother 'u003cb'u003eCow'u003c/b'u003e | Facebook",
   "link": "https://www.facebook.com/Rashtriye-Goraksha-Sena-Appeal-Pls-Save-Mother-Cow-221677674546931/",
   "displayLink": "www.facebook.com",
   "snippet": "Rashtriye Goraksha Sena Appeal Pls Save Mother Cow. 1610 likes. Personal 'nBlog.",
   "htmlSnippet": "Rashtriye Goraksha Sena Appeal 'u003cb'u003ePls'u003c/b'u003e Save Mother 'u003cb'u003eCow'u003c/b'u003e. 1610 likes. Personal 'u003cbr'u003e'nBlog.",
   "cacheId": "uBjkLN7P_sQJ",
   "formattedUrl": "https://www.facebook.com/Rashtriye-Goraksha-Sena-Appeal-Pls-Save- Mother-Cow-221677674546931/",
   "htmlFormattedUrl": "https://www.facebook.com/Rashtriye-Goraksha-Sena-Appeal-'u003cb'u003ePls'u003c/b'u003e-Save- Mother-'u003cb'u003eCow'u003c/b'u003e-221677674546931/",
   "pagemap": {
    "organization": [
     {
      "name": "Rashtriye Goraksha Sena Appeal Pls Save Mother Cow"
     }
    ],
    "metatags": [
     {
      "referrer": "default",
      "al:android:app_name": "Facebook",
      "al:android:package": "com.facebook.katana",
      "al:android:url": "fb://page/221677674546931",
      "al:ios:app_name": "Facebook",
      "al:ios:app_store_id": "284882215",
      "al:ios:url": "fb://page/?id=221677674546931"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Pls Watch & Share to Save 100s of Cattle !!! - YouTube",
   "htmlTitle": "'u003cb'u003ePls'u003c/b'u003e Watch & Share to Save 100s of 'u003cb'u003eCattle'u003c/b'u003e !!! - YouTube",
   "link": "https://www.youtube.com/watch?v=9SN1U8fu5Xg",
   "displayLink": "www.youtube.com",
   "snippet": "Sep 7, 2015 ... Donation Appeal in aid of Indian Institute of Animal Welfare - IIAW, founded and 'nmanaged by Dr. Sadhana Rao. IIAW houses many of the Cattle ...",
   "htmlSnippet": "Sep 7, 2015 'u003cb'u003e...'u003c/b'u003e Donation Appeal in aid of Indian Institute of Animal Welfare - IIAW, founded and 'u003cbr'u003e'nmanaged by Dr. Sadhana Rao. IIAW houses many of the 'u003cb'u003eCattle'u003c/b'u003e ...",
   "cacheId": "0yUKDIJx6acJ",
   "formattedUrl": "https://www.youtube.com/watch?v=9SN1U8fu5Xg",
   "htmlFormattedUrl": "https://www.youtube.com/watch?v=9SN1U8fu5Xg",
   "pagemap": {
    "cse_thumbnail": [
     {
      "width": "300",
      "height": "168",
      "src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQMgRUnI-V7Q456-yHIlcE4oKedPC3i6miWrwHHUYAmXAXuUNE_1u1cLrU"
     }
    ],
    "imageobject": [
     {
      "url": "https://i.ytimg.com/vi/9SN1U8fu5Xg/maxresdefault.jpg",
      "width": "1280",
      "height": "720"
     }
    ],
    "person": [
     {
      "url": "http://www.youtube.com/channel/UChZ9DuVZa2TFPj5BEG2pG4w"
     },
     {
      "url": "https://plus.google.com/116745944431978640924"
     }
    ],
    "metatags": [
     {
      "title": "Pls Watch & Share to Save 100s of Cattle !!!",
      "theme-color": "#e62117",
      "og:site_name": "YouTube",
      "og:url": "https://www.youtube.com/watch?v=9SN1U8fu5Xg",
      "og:title": "Pls Watch & Share to Save 100s of Cattle !!!",
      "og:image": "https://i.ytimg.com/vi/9SN1U8fu5Xg/maxresdefault.jpg",
      "og:description": "Donation Appeal in aid of Indian Institute of Animal Welfare - IIAW, founded and managed by Dr. Sadhana Rao. IIAW houses many of the Cattle rescued from slau...",
      "al:ios:app_store_id": "544007664",
      "al:ios:app_name": "YouTube",
      "al:ios:url": "vnd.youtube://www.youtube.com/watch?v=9SN1U8fu5Xg&feature=applinks",
      "al:android:url": "vnd.youtube://www.youtube.com/watch?v=9SN1U8fu5Xg&feature=applinks",
      "al:android:app_name": "YouTube",
      "al:android:package": "com.google.android.youtube",
      "al:web:url": "https://www.youtube.com/watch?v=9SN1U8fu5Xg&feature=applinks",
      "og:type": "video",
      "og:video:url": "https://www.youtube.com/embed/9SN1U8fu5Xg",
      "og:video:secure_url": "https://www.youtube.com/embed/9SN1U8fu5Xg",
      "og:video:type": "text/html",
      "og:video:width": "1280",
      "og:video:height": "720",
      "og:video:tag": "Cattle (Animal)",
      "fb:app_id": "87741124305",
      "twitter:card": "player",
      "twitter:site": "@youtube",
      "twitter:url": "https://www.youtube.com/watch?v=9SN1U8fu5Xg",
      "twitter:title": "Pls Watch & Share to Save 100s of Cattle !!!",
      "twitter:description": "Donation Appeal in aid of Indian Institute of Animal Welfare - IIAW, founded and managed by Dr. Sadhana Rao. IIAW houses many of the Cattle rescued from slau...",
      "twitter:image": "https://i.ytimg.com/vi/9SN1U8fu5Xg/maxresdefault.jpg",
      "twitter:app:name:iphone": "YouTube"
     }
    ],
    "videoobject": [
     {
      "url": "https://www.youtube.com/watch?v=9SN1U8fu5Xg",
      "name": "Pls Watch & Share to Save 100s of Cattle !!!",
      "description": "Donation Appeal in aid of Indian Institute of Animal Welfare - IIAW, founded and managed by Dr. Sadhana Rao. IIAW houses many of the Cattle rescued from slau...",
      "paid": "False",
      "channelid": "UChZ9DuVZa2TFPj5BEG2pG4w",
      "videoid": "9SN1U8fu5Xg",
      "duration": "PT6M11S",
      "unlisted": "False",
      "thumbnailurl": "https://i.ytimg.com/vi/9SN1U8fu5Xg/maxresdefault.jpg",
      "embedurl": "https://www.youtube.com/embed/9SN1U8fu5Xg",
      "playertype": "HTML5 Flash",
      "width": "1280",
      "height": "720",
      "isfamilyfriendly": "True",
      "regionsallowed": "AD,AE,AF,AG,AI,AL,AM,AO,AQ,AR,AS,AT,AU,AW,AX,AZ,BA,BB,BD,BE,BF,BG,BH,BI,BJ,BL,BM,BN,BO,BQ,BR,BS,BT,BV,BW,BY,BZ,CA,CC,CD,CF,CG,CH,CI,CK,CL,CM,CN,CO,CR,CU,CV,CW,CX,CY,CZ,DE,DJ,DK,DM,DO,DZ,EC,EE,EG,EH...",
      "interactioncount": "216",
      "datepublished": "2015-09-07",
      "genre": "Nonprofits & Activism"
     }
    ],
    "cse_image": [
     {
      "src": "https://i.ytimg.com/vi/9SN1U8fu5Xg/maxresdefault.jpg"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "PLS |",
   "htmlTitle": "'u003cb'u003ePLS'u003c/b'u003e |",
   "link": "http://www.crplsa.info/tag/pls/",
   "displayLink": "www.crplsa.info",
   "snippet": "Feb 24, 2016 ... Pioneerland Library System (PLS) is rolling out iPads to libraries for patron ... 'nHello Once Upon a Reader fans, Cow took a day off from her ...",
   "htmlSnippet": "Feb 24, 2016 'u003cb'u003e...'u003c/b'u003e Pioneerland Library System ('u003cb'u003ePLS'u003c/b'u003e) is rolling out iPads to libraries for patron ... 'u003cbr'u003e'nHello Once Upon a Reader fans, 'u003cb'u003eCow'u003c/b'u003e took a day off from her ...",
   "cacheId": "cX8W_F66RGgJ",
   "formattedUrl": "www.crplsa.info/tag/pls/",
   "htmlFormattedUrl": "www.cr'u003cb'u003epls'u003c/b'u003ea.info/tag/'u003cb'u003epls'u003c/b'u003e/"
  },
  {
   "kind": "customsearch#result",
   "title": "Prediction of fatty acid profiles in cow, ewe, and goat milk by mid ...",
   "htmlTitle": "Prediction of fatty acid profiles in 'u003cb'u003ecow'u003c/b'u003e, ewe, and goat milk by mid ...",
   "link": "http://www.sciencedirect.com/science/article/pii/S002203021300790X",
   "displayLink": "www.sciencedirect.com",
   "snippet": "In total, a set of 349 cow milk samples, 200 ewe milk samples, and 332 goat milk 'n... The best results were obtained with PLS, genetic algorithm + PLS and first ...",
   "htmlSnippet": "In total, a set of 349 'u003cb'u003ecow'u003c/b'u003e milk samples, 200 ewe milk samples, and 332 goat milk 'u003cbr'u003e'n... The best results were obtained with 'u003cb'u003ePLS'u003c/b'u003e, genetic algorithm + 'u003cb'u003ePLS'u003c/b'u003e and first ...",
   "formattedUrl": "www.sciencedirect.com/science/article/pii/S002203021300790X",
   "htmlFormattedUrl": "www.sciencedirect.com/science/article/pii/S002203021300790X",
   "pagemap": {
    "metatags": [
     {
      "citation_publisher": "Elsevier",
      "citation_journal_title": "Journal of Dairy Science",
      "citation_issn": "0022-0302",
      "citation_volume": "97",
      "citation_issue": "1",
      "citation_date": "2014/01/31",
      "citation_title": "Prediction of fatty acid profiles in cow, ewe, and goat milk by mid-infrared spectrometry",
      "citation_firstpage": "17",
      "citation_lastpage": "35",
      "citation_type": "JOUR",
      "citation_pii": "S002203021300790X",
      "citation_doi": "10.3168/jds.2013-6648",
      "citation_author": "M. Ferrand-Calmels",
      "citation_reference": "citation_journal_title=J. Dairy Sci.;citation_author=L. Alonso;citation_author=L. Fontecha;citation_author=L. Lozada;citation_author=M.J. Fraga;citation_author=M. Juarez;citation_title=Fatty acid composition of caprine milk: Major, branched chain, and trans fatty acids;citation_pages=878-884;citation_volume=82;citation_publication_date=1999;"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Release Notes Version 6 5 - Eigenvector Documentation Wiki",
   "htmlTitle": "Release Notes Version 6 5 - Eigenvector Documentation Wiki",
   "link": "http://wiki.eigenvector.com/index.php?title=Release_Notes_Version_6_5",
   "displayLink": "wiki.eigenvector.com",
   "snippet": "Nov 4, 2011 ... (back to Release Notes PLS Toolbox and Solo) ... Correlation Optimized Warping 'n(COW)); Correlation Optimized Warping (COW) and Dynamic ...",
   "htmlSnippet": "Nov 4, 2011 'u003cb'u003e...'u003c/b'u003e (back to Release Notes 'u003cb'u003ePLS'u003c/b'u003e Toolbox and Solo) ... Correlation Optimized Warping 'u003cbr'u003e'n('u003cb'u003eCOW'u003c/b'u003e)); Correlation Optimized Warping ('u003cb'u003eCOW'u003c/b'u003e) and Dynamic ...",
   "cacheId": "X0DL00QAEJwJ",
   "formattedUrl": "wiki.eigenvector.com/index.php?title=Release_Notes_Version...",
   "htmlFormattedUrl": "wiki.eigenvector.com/index.php?title=Release_Notes_Version..."
  },
  {
   "kind": "customsearch#result",
   "title": "Determination of fatty acid profile in cow's milk using mid-infrared ...",
   "htmlTitle": "Determination of fatty acid profile in 'u003cb'u003ecow's'u003c/b'u003e milk using mid-infrared ...",
   "link": "http://www.sciencedirect.com/science/article/pii/S0169743910000808",
   "displayLink": "www.sciencedirect.com",
   "snippet": "Determination of fatty acid profile in cow's milk using mid-infrared spectrometry: 'nInterest of applying a variable selection by genetic algorithms before a PLS ...",
   "htmlSnippet": "Determination of fatty acid profile in 'u003cb'u003ecow's'u003c/b'u003e milk using mid-infrared spectrometry: 'u003cbr'u003e'nInterest of applying a variable selection by genetic algorithms before a 'u003cb'u003ePLS'u003c/b'u003e ...",
   "formattedUrl": "www.sciencedirect.com/science/article/pii/S0169743910000808",
   "htmlFormattedUrl": "www.sciencedirect.com/science/article/pii/S0169743910000808",
   "pagemap": {
    "metatags": [
     {
      "citation_publisher": "Elsevier",
      "citation_journal_title": "Chemometrics and Intelligent Laboratory Systems",
      "citation_issn": "0169-7439",
      "citation_volume": "106",
      "citation_issue": "2",
      "citation_date": "2011/04/15",
      "citation_title": "Determination of fatty acid profile in cow's milk using mid-infrared spectrometry: Interest of applying a variable selection by genetic algorithms before a PLS regression",
      "citation_firstpage": "183",
      "citation_lastpage": "189",
      "citation_type": "JOUR",
      "citation_pii": "S0169743910000808",
      "citation_doi": "10.1016/j.chemolab.2010.05.004",
      "citation_author": "M. Ferrand",
      "citation_reference": "citation_journal_title=J. Dairy Sci.;citation_author=H. Soyeurt;citation_author=P. Dardenne;citation_author=F. Dehareng;citation_author=G. Lognay;citation_author=G. Veselko;citation_author=M. Marlier;citation_author=C. Bertozzi;citation_author=P. Mayeres;citation_author=N. Gengler;citation_title=Estimating fatty acid content in cow milk using mid-infrared spectrometry;citation_pages=3690-3695;citation_volume=89;citation_publication_date=2006;"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "tree care - How can I protect my plants from cows and goats ...",
   "htmlTitle": "tree care - How can I protect my plants from 'u003cb'u003ecows'u003c/b'u003e and goats ...",
   "link": "http://gardening.stackexchange.com/questions/24182/how-can-i-protect-my-plants-from-cows-and-goats",
   "displayLink": "gardening.stackexchange.com",
   "snippet": "Apr 20, 2016 ... How can I protect my plants from cows and goats? ... Tips needed for protecting 'nmy plants from animals like cows and goats. tree-care ...",
   "htmlSnippet": "Apr 20, 2016 'u003cb'u003e...'u003c/b'u003e How can I protect my plants from 'u003cb'u003ecows'u003c/b'u003e and goats? ... Tips needed for protecting 'u003cbr'u003e'nmy plants from animals like 'u003cb'u003ecows'u003c/b'u003e and goats. tree-care ...",
   "cacheId": "oD4rS0U8YIUJ",
   "formattedUrl": "gardening.stackexchange.com/.../how-can-i-protect-my-plants-from-cows- and-goats",
   "htmlFormattedUrl": "gardening.stackexchange.com/.../how-can-i-protect-my-plants-from-'u003cb'u003ecows'u003c/b'u003e- and-goats",
   "pagemap": {
    "cse_thumbnail": [
     {
      "width": "221",
      "height": "228",
      "src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTjK8TEEF3xhJs6cpZmDxoQ5Dlru5ghyChIBp9AENIqqqNvlTN6wiEpe18"
     }
    ],
    "qapage": [
     {
      "image": "http://cdn.sstatic.net/Sites/gardening/img/apple-touch-icon.png?v=1217ec2c2a6b&a",
      "primaryimageofpage": "http://cdn.sstatic.net/Sites/gardening/img/apple-touch-icon.png?v=1217ec2c2a6b&a",
      "title": "How can I protect my plants from cows and goats?",
      "name": "How can I protect my plants from cows and goats?",
      "description": "Tips needed for protecting my plants from animals like cows and goats."
     }
    ],
    "question": [
     {
      "image": "http://cdn.sstatic.net/Sites/gardening/img/apple-touch-icon.png?v=1217ec2c2a6b",
      "name": "How can I protect my plants from cows and goats?",
      "upvotecount": "4",
      "text": "Tips needed for protecting my plants from animals like cows and goats.",
      "answerswercount": "2"
     }
    ],
    "answerswer": [
     {
      "upvotecount": "7",
      "text": "You will have some difficulty (at least from goats). There are a few solutions I'm aware of - Kill the goat(s) - Its the only way to be sure. Put goats on a chain or in a run (arguably more..."
     },
     {
      "upvotecount": "6",
      "text": "You need to build a fence, or a wall."
     }
    ],
    "metatags": [
     {
      "twitter:card": "summary",
      "twitter:site": "@StackGardening",
      "twitter:domain": "gardening.stackexchange.com",
      "og:type": "website",
      "og:image": "http://cdn.sstatic.net/Sites/gardening/img/apple-touch-icon.png?v=1217ec2c2a6b&a",
      "twitter:title": "How can I protect my plants from cows and goats?",
      "twitter:description": "Tips needed for protecting my plants from animals like cows and goats.",
      "og:url": "http://gardening.stackexchange.com/questions/24182/how-can-i-protect-my-plants-from-cows-and-goats",
      "twitter:app:country": "US",
      "twitter:app:name:iphone": "Stack Exchange iOS",
      "twitter:app:id:iphone": "871299723",
      "twitter:app:url:iphone": "se-zaphod://gardening.stackexchange.com/questions/24182/how-can-i-protect-my-plants-from-cows-and-goats",
      "twitter:app:name:ipad": "Stack Exchange iOS",
      "twitter:app:id:ipad": "871299723",
      "twitter:app:url:ipad": "se-zaphod://gardening.stackexchange.com/questions/24182/how-can-i-protect-my-plants-from-cows-and-goats",
      "twitter:app:name:googleplay": "Stack Exchange Android",
      "twitter:app:url:googleplay": "http://gardening.stackexchange.com/questions/24182/how-can-i-protect-my-plants-from-cows-and-goats",
      "twitter:app:id:googleplay": "com.stackexchange.marvin"
     }
    ],
    "cse_image": [
     {
      "src": "https://i.stack.imgur.com/AXC1V.jpg"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Prediction of fatty acid profiles in cow, ewe, and goat milk by mid ...",
   "htmlTitle": "Prediction of fatty acid profiles in 'u003cb'u003ecow'u003c/b'u003e, ewe, and goat milk by mid ...",
   "link": "http://www.ncbi.nlm.nih.gov/pubmed/24268398",
   "displayLink": "www.ncbi.nlm.nih.gov",
   "snippet": "Nov 21, 2013 ... Prediction of fatty acid profiles in cow, ewe, and goat milk by ... were obtained 'nwith PLS, genetic algorithm + PLS and first derivative + PLS.",
   "htmlSnippet": "Nov 21, 2013 'u003cb'u003e...'u003c/b'u003e Prediction of fatty acid profiles in 'u003cb'u003ecow'u003c/b'u003e, ewe, and goat milk by ... were obtained 'u003cbr'u003e'nwith 'u003cb'u003ePLS'u003c/b'u003e, genetic algorithm + 'u003cb'u003ePLS'u003c/b'u003e and first derivative + 'u003cb'u003ePLS'u003c/b'u003e.",
   "formattedUrl": "www.ncbi.nlm.nih.gov/pubmed/24268398",
   "htmlFormattedUrl": "www.ncbi.nlm.nih.gov/pubmed/24268398",
   "pagemap": {
    "metatags": [
     {
      "citation_title": "Prediction of fatty acid profiles in cow, ewe, and goat milk by mid-infrared spectrometry.",
      "citation_authors": "Ferrand-Calmels M; Palhière I; Brochard M; Leray O; Astruc JM; Aurel MR; Barbey S; Bouvier F; Brunschwig P; Caillat H; Douguet M; Faucon-Lahalle F; Gelé M; Thomas G; Trommenschlager JM; Larroque H",
      "citation_date": "2014",
      "citation_publisher": "J Dairy Sci",
      "citation_journal_title": "Journal of dairy science",
      "citation_pmid": "24268398",
      "citation_abstract_html_url": "http://www.ncbi.nlm.nih.gov/pubmed/24268398",
      "citation_volume": "97",
      "citation_issue": "1",
      "citation_firstpage": "17",
      "citation_doi": "10.3168/jds.2013-6648",
      "citation_issn": "1525-3198"
     }
    ]
   }
  }
 ]
}

使用以下代码

result=JSON.parse(body);
callback(result);
console.log(result);

它将向我返回一个有效的JSON我得到了前面提到的JSON,它都很好

不幸的是,我不想要JSON…我只想要第一个URL

我试过

console.log(result.items.link)
console.log(result.items.0.link)
console.log(result.items."0".link)

这些版本都不起作用。我的Json解析器错了吗?

您想要进行

result.items[0].link

result.items是一个数组。若要访问数组的第一个元素,必须使用方括号。