Skip to content
Advertisement

How to print object in Node JS

In the below code (running on Node JS) I am trying to print an object obtained from an external API using JSON.stringify which results in an error:

TypeError: Converting circular structure to JSON

I have looked at the questions on this topic, but none could help. Could some one please suggest:

a) How I could obtain country value from the res object ?

b) How I could print the entire object itself ?

JavaScript

Advertisement

Answer

By using the http request client, I am able to print the JSON object as well as print the country value. Below is my updated code.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement