So, I'm working on getting info from an API through Node.js the returned file from the API server is a JSON file and I've tried parsing it through JSON.parse();
but to no avail. I've tried calling the api through https.request();
, http.get();
, and also using request(url, function);
and I am able to put the returned value into process.stdout.write(returnedJson);
.. But I can't get it to the point where I could loop through the values, or even pick out a specific value.
Here is an example of the JSON I get from the api ...
{
status: 0,
data: [
{
TripId: 12442,
Name: John Doe,
Date: April 1, 1970
},
{
TripId: 35314,
Name: Jane Doe,
Date: April 2, 1970
}
]
}
When I used JSON.parse(returnedJson);
I usually get [object Object]
as my return from that if I try to use console.log(returnedJson);
Any Help would be great! If I need to add some more info please let me know and I will!