title: How to print object in Node JS
body: <p>In the below code (running on Node JS) I am trying to print an object obtained from an external API using <code>JSON.stringify</code> which results in an error:  </p>
  
  <blockquote>
    <p>TypeError: Converting circular structure to JSON</p>
  </blockquote>
  
  <p>I have looked at the questions on this topic, but none could help. Could some one please suggest: </p>
  
  <p>a) How I could obtain <code>country</code> value from the <code>res</code> object ?</p>
  
  <p>b) How I could <strong>print</strong> the entire object itself ?</p>
  
  <pre><code>  http.get('http://ip-api.com/json', (res) =&gt; {     
      console.log(`Got response: ${res.statusCode}`);
      console.log(res.country)  // *** Results in Undefined
      console.log(JSON.stringify(res)); // *** Resulting in a TypeError: Converting circular structure to JSON
  
      res.resume();
    }).on('error', (e) =&gt; {
      console.log(`Got error: ${e.message}`);
    });
  </code></pre>