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:
JSON.stringify
This can print the key of the object and the value of the object in the simplest way. Just try it.
const jsonObj = { a: 'somestring', b: 42, c: false }; Array.from(Object.keys(jsonObj)).forEach(function(key){ console.log(key + ":" + jsonObj[key]); });