title: Get values from request.body in Node
body: <p>I am working on a node project which use google search api. I am getting the reponse in the following way:</p>
  <pre><code>{
    kind: 'customsearch#search',
    url: {
      type: 'application/json',
      template: 'https://www.googleapis.com/customsearch/v1?q={searchTerms}&amp;num={count?}&amp;start={startIndex?}&amp;lr={language?}&amp;safe={safe?}&amp;cx={cx?}&amp;sort={sort?}&amp;filter={filter?}&amp;gl={gl?}&amp;cr={cr?}&amp;googlehost={googleHost?}&amp;c2coff={disableCnTwTranslation?}&amp;hq={hq?}&amp;hl={hl?}&amp;siteSearch={siteSearch?}&amp;siteSearchFilter={siteSearchFilter?}&amp;exactTerms={exactTerms?}&amp;excludeTerms={excludeTerms?}&amp;linkSite={linkSite?}&amp;orTerms={orTerms?}&amp;relatedSite={relatedSite?}&amp;dateRestrict={dateRestrict?}&amp;lowRange={lowRange?}&amp;highRange={highRange?}&amp;searchType={searchType}&amp;fileType={fileType?}&amp;rights={rights?}&amp;imgSize={imgSize?}&amp;imgType={imgType?}&amp;imgColorType={imgColorType?}&amp;imgDominantColor={imgDominantColor?}&amp;alt=json'
    },
    queries: { request: [ [Object] ] },
    context: { title: 'CS Curriculum', facets: [ [Array], [Array], [Array] ] },
    searchInformation: {
      searchTime: 0.577799,
      formattedSearchTime: '0.58',
      totalResults: '10',
      formattedTotalResults: '10'
    },
    items: [
      {
        kind: 'customsearch#result',
        title: '2021 News | Department of Computer Science',
        htmlTitle: '2021 &lt;b&gt;News&lt;/b&gt; | Department of Computer Science',
        link: 'https://www.cs.utexas.edu/news/articles/index2002',
        displayLink: 'www.cs.utexas.edu',
        snippet: 'Campus health and safety are our top priorities. Get the latest from UT on COVID-\n' +
          '19. Get help with Instructional Continuity and working from home. About · News ...',
        htmlSnippet: 'Campus health and safety are our top priorities. Get the latest from UT on &lt;b&gt;COVID&lt;/b&gt;-&lt;br&gt;\n' +
          '19. Get help with Instructional Continuity and working from home. About &amp;middot; &lt;b&gt;News&lt;/b&gt;&amp;nbsp;...',
        cacheId: '7AHQ45k8IUUJ',
        formattedUrl: 'https://www.cs.utexas.edu/news/articles/index2002',
        htmlFormattedUrl: 'https://www.cs.utexas.edu/&lt;b&gt;news&lt;/b&gt;/&lt;b&gt;articles&lt;/b&gt;/index2002',
        pagemap: [Object]
      },
      {
        kind: 'customsearch#result',
        title: 'New York Daily News | News Sources | Department of Computer ...',
        htmlTitle: 'New York Daily &lt;b&gt;News&lt;/b&gt; | &lt;b&gt;News&lt;/b&gt; Sources | Department of Computer ...',
        link: 'https://www.cs.columbia.edu/news-source/new-york-daily-news/',
        displayLink: 'www.cs.columbia.edu',
        snippet: 'Learn more about the COVID-19 Response ... In the News ... New Twitter Feature \n' +
          'Challenges Users to Read Articles Before Sharing (Peter Allen,Daniel Bauer ...',
        htmlSnippet: 'Learn more about the &lt;b&gt;COVID&lt;/b&gt;-19 Response ... In the &lt;b&gt;News&lt;/b&gt; ... New Twitter Feature &lt;br&gt;\n' +
          'Challenges Users to Read &lt;b&gt;Articles&lt;/b&gt; Before Sharing (Peter Allen,Daniel Bauer&amp;nbsp;...',
        cacheId: 'H0RrwEK65C8J',
        formattedUrl: 'https://www.cs.columbia.edu/news-source/new-york-daily-news/',
        htmlFormattedUrl: 'https://www.cs.columbia.edu/&lt;b&gt;news&lt;/b&gt;-source/new-york-daily-&lt;b&gt;news&lt;/b&gt;/',
        pagemap: [Object]
      },
      {
        kind: 'customsearch#result',
        title: 'Smithsonian.com | News Sources | Department of Computer ...',
        htmlTitle: 'Smithsonian.com | &lt;b&gt;News&lt;/b&gt; Sources | Department of Computer ...',
        link: 'https://www.cs.columbia.edu/news-source/smithsonian-com/',
        displayLink: 'www.cs.columbia.edu',
        snippet: 'COVID-19 Response. The Columbia Engineering community has come together \n' +
          'to combat the coronavirus pandemic on multiple fronts. In close collabo-ration ...',
        htmlSnippet: '&lt;b&gt;COVID&lt;/b&gt;-19 Response. The Columbia Engineering community has come together &lt;br&gt;\n' +
          'to combat the &lt;b&gt;coronavirus&lt;/b&gt; pandemic on multiple fronts. In close collabo-ration&amp;nbsp;...',
        cacheId: 'eLnifJe1zycJ',
        formattedUrl: 'https://www.cs.columbia.edu/news-source/smithsonian-com/',
        htmlFormattedUrl: 'https://www.cs.columbia.edu/&lt;b&gt;news&lt;/b&gt;-source/smithsonian-com/',
        pagemap: [Object]
      },
      {
        kind: 'customsearch#result',
        title: '2020 News | Page 2 | Department of Computer Science',
        htmlTitle: '2020 &lt;b&gt;News&lt;/b&gt; | Page 2 | Department of Computer Science',
        link: 'https://www.cs.utexas.edu/news/articles/index2002?page=1',
        displayLink: 'www.cs.utexas.edu',
        snippet: 'Campus health and safety are our top priorities. Get the latest from UT on COVID-\n' +
          '19. Get help with Instructional Continuity and working from home.',
        htmlSnippet: 'Campus health and safety are our top priorities. Get the latest from UT on &lt;b&gt;COVID&lt;/b&gt;-&lt;br&gt;\n' +
          '19. Get help with Instructional Continuity and working from home.',
        cacheId: 'S47VULaZRu8J',
        formattedUrl: 'https://www.cs.utexas.edu/news/articles/index2002?page=1',
        htmlFormattedUrl: 'https://www.cs.utexas.edu/&lt;b&gt;news&lt;/b&gt;/&lt;b&gt;articles&lt;/b&gt;/index2002?page=1',
        pagemap: [Object]
      },
      {
        kind: 'customsearch#result',
        title: 'Your Houston News | News Sources | Department of Computer ...',
        htmlTitle: 'Your Houston &lt;b&gt;News&lt;/b&gt; | &lt;b&gt;News&lt;/b&gt; Sources | Department of Computer ...',
        link: 'https://www.cs.columbia.edu/news-source/your-houston-news/',
        displayLink: 'www.cs.columbia.edu',
        snippet: 'Learn more about the COVID-19 Response ... In the News ... New Twitter Feature \n' +
          'Challenges Users to Read Articles Before Sharing (Peter Allen,Daniel Bauer ...',
        htmlSnippet: 'Learn more about the &lt;b&gt;COVID&lt;/b&gt;-19 Response ... In the &lt;b&gt;News&lt;/b&gt; ... New Twitter Feature &lt;br&gt;\n' +
          'Challenges Users to Read &lt;b&gt;Articles&lt;/b&gt; Before Sharing (Peter Allen,Daniel Bauer&amp;nbsp;...',
        cacheId: 'JRaK3HT4SeYJ',
        formattedUrl: 'https://www.cs.columbia.edu/news-source/your-houston-news/',
        htmlFormattedUrl: 'https://www.cs.columbia.edu/&lt;b&gt;news&lt;/b&gt;-source/your-houston-&lt;b&gt;news&lt;/b&gt;/',
        pagemap: [Object]
      },
      {
        kind: 'customsearch#result',
        title: 'Newsday | News Sources | Department of Computer Science ...',
        htmlTitle: 'Newsday | &lt;b&gt;News&lt;/b&gt; Sources | Department of Computer Science ...',
        link: 'https://www.cs.columbia.edu/news-source/newsday/',
        displayLink: 'www.cs.columbia.edu',
        snippet: 'Learn more about the COVID-19 Response ... In the News ... New Twitter Feature \n' +
          'Challenges Users to Read Articles Before Sharing (Peter Allen,Daniel Bauer ...',
        htmlSnippet: 'Learn more about the &lt;b&gt;COVID&lt;/b&gt;-19 Response ... In the &lt;b&gt;News&lt;/b&gt; ... New Twitter Feature &lt;br&gt;\n' +
          'Challenges Users to Read &lt;b&gt;Articles&lt;/b&gt; Before Sharing (Peter Allen,Daniel Bauer&amp;nbsp;...',
        cacheId: 'EwzgYOy-S6YJ',
        formattedUrl: 'https://www.cs.columbia.edu/news-source/newsday/',
        htmlFormattedUrl: 'https://www.cs.columbia.edu/&lt;b&gt;news&lt;/b&gt;-source/&lt;b&gt;news&lt;/b&gt;day/',
        pagemap: [Object]
      },
      {
        kind: 'customsearch#result',
        title: 'Globalization and Offshoring of Software',
        htmlTitle: 'Globalization and Offshoring of Software',
        link: 'https://www.acm.org/binaries/content/assets/public-policy/usacm/intellectual-property/reports-and-white-papers/full_final1.pdf',
        displayLink: 'www.acm.org',
        snippet: 'While articles on offshoring and outsourcing appeared in the media weekly, ... \n' +
          'Source: Compilation from various newspaper articles by Martin Wildemann 2005:\n' +
          ' ...',
        htmlSnippet: 'While &lt;b&gt;articles&lt;/b&gt; on offshoring and outsourcing appeared in the media weekly, ... &lt;br&gt;\n' +
          'Source: Compilation from various &lt;b&gt;newspaper articles&lt;/b&gt; by Martin Wildemann 2005:&lt;br&gt;\n' +
          '&amp;nbsp;...',
        formattedUrl: 'https://www.acm.org/binaries/content/assets/public.../full_final1.pdf',
        htmlFormattedUrl: 'https://www.acm.org/binaries/content/assets/public.../full_final1.pdf',
        pagemap: [Object],
        mime: 'application/pdf',
        fileFormat: 'PDF/Adobe Acrobat'
      },
      {
        kind: 'customsearch#result',
        title: 'data hub | Department of Computer Science, Columbia University',
        htmlTitle: 'data hub | Department of Computer Science, Columbia University',
        link: 'https://www.cs.columbia.edu/tag/data-hub/',
        displayLink: 'www.cs.columbia.edu',
        snippet: 'For the COVID-19 Hub, CRAC was asked to join a team along with CUIT and \n' +
          'senior leadership across every ... I was interested because of the COVID-related \n' +
          'nature of the project. ... In the News ... New Twitter Feature Challenges Users to \n' +
          'Read Articles Before Sharing (Peter Allen,Daniel Bauer,Augustin Chaintreau) ...',
        htmlSnippet: 'For the &lt;b&gt;COVID&lt;/b&gt;-19 Hub, CRAC was asked to join a team along with CUIT and &lt;br&gt;\n' +
          'senior leadership across every ... I was interested because of the &lt;b&gt;COVID&lt;/b&gt;-related &lt;br&gt;\n' +
          'nature of the project. ... In the &lt;b&gt;News&lt;/b&gt; ... New Twitter Feature Challenges Users to &lt;br&gt;\n' +
          'Read &lt;b&gt;Articles&lt;/b&gt; Before Sharing (Peter Allen,Daniel Bauer,Augustin Chaintreau)&amp;nbsp;...',
        cacheId: 'r5LNPkX3GMIJ',
        formattedUrl: 'https://www.cs.columbia.edu/tag/data-hub/',
        htmlFormattedUrl: 'https://www.cs.columbia.edu/tag/data-hub/',
        pagemap: [Object]
      },
      {
        kind: 'customsearch#result',
        title: 'Association for Computing Machinery',
        htmlTitle: 'Association for Computing Machinery',
        link: 'https://www.acm.org/?p=t&amp;offset=45',
        displayLink: 'www.acm.org',
        snippet: 'Read the IFIP news release. ... CRA Surveys Computer Science Faculty, \n' +
          &quot;Department Heads on COVID-19's Impacts ... sensitive interests FB has assigned \n&quot; +
          'them in a Contributed Article in the January 2021 issue of Communications of the \n' +
          'ACM.',
        htmlSnippet: 'Read the IFIP &lt;b&gt;news&lt;/b&gt; release. ... CRA Surveys Computer Science Faculty, &lt;br&gt;\n' +
          'Department Heads on &lt;b&gt;COVID&lt;/b&gt;-19&amp;#39;s Impacts ... sensitive interests FB has assigned &lt;br&gt;\n' +
          'them in a Contributed &lt;b&gt;Article&lt;/b&gt; in the January 2021 issue of Communications of the &lt;br&gt;\n' +
          'ACM.',
        cacheId: '4E0D_zMzG8kJ',
        formattedUrl: 'https://www.acm.org/?p=t&amp;offset=45',
        htmlFormattedUrl: 'https://www.acm.org/?p=t&amp;amp;offset=45',
        pagemap: [Object]
      },
      {
        kind: 'customsearch#result',
        title: 'Revelation and Bible Prophecy',
        htmlTitle: 'Revelation and Bible Prophecy',
        link: 'http://www.cs.ubc.ca/~knorr/public/comparison_of_eschat_models.pdf',
        displayLink: 'www.cs.ubc.ca',
        snippet: '6 days ago ... dispensationalists) have a newspaper in one hand, and a Bible in the other. \n' +
          'Instead ... articles (“a”, “an”, or “the”) present in some of those passages in the \n' +
          'Greek. ... events (e.g., flu outbreaks, COVID-19 coronavirus), corporate.',
        htmlSnippet: '6 days ago &lt;b&gt;...&lt;/b&gt; dispensationalists) have a &lt;b&gt;newspaper&lt;/b&gt; in one hand, and a Bible in the other. &lt;br&gt;\n' +
          'Instead ... &lt;b&gt;articles&lt;/b&gt; (“a”, “an”, or “the”) present in some of those passages in the &lt;br&gt;\n' +
          'Greek. ... events (e.g., flu outbreaks, &lt;b&gt;COVID&lt;/b&gt;-19 &lt;b&gt;coronavirus&lt;/b&gt;), corporate.',
        formattedUrl: 'www.cs.ubc.ca/~knorr/public/comparison_of_eschat_models.pdf',
        htmlFormattedUrl: 'www.cs.ubc.ca/~knorr/public/comparison_of_eschat_models.pdf',
        pagemap: [Object],
        mime: 'application/pdf',
        fileFormat: 'PDF/Adobe Acrobat'
      }
    ]
  }
  </code></pre>
  <p>How to extract all the keys and values from the above object? When I printed <code>res.body['kind']</code>, it printed only the first key in the object. And when I tried to print <code>res.body['items']</code>, it threw an error items not defined. How to extract the items list from the object</p>
  <p>Edit: I am using <code>unirest</code> node module to get the content from the api:</p>
  <pre><code>  var req = unirest(
      &quot;GET&quot;,
      &quot;https://www.googleapis.com/customsearch/v1?key=&lt;key here&gt;&amp;cx=&lt;cx here&gt;&amp;q=covid+news+articles&amp;g1=ca&quot;
    );
    req.end(function (res) {
      if (res.error) throw new Error(res.error);
  
      console.log(res.body);
    });
  
    });
  </code></pre>
  <p>When I printed <code>res.body</code>, I got the above dictionary. I want to extract all the keys and their respective values from above dictionary using <code>res.body</code></p>