I’m having trouble reading properties from JSON within NodeJS.
Feels like an obvious mistake I may be making..
The JSON is from this endpoint;
http://hypem.com/playlist/history/faisdotal/json/1/data.js
My code:
var request = require('request');
request("http://hypem.com/playlist/history/faisdotal/json/1/data.js", function (err, res, json) {
JSON.parse(json);
console.log(json["1"]["artist"]); // undefined
});
~
I think you want:
It won’t (and can’t) simply update the value of the parameter. The
.parse()routine returns the value parsed from the string you pass it.JavaScript is purely call-by-value, so there’s really no way it could possibly work the way your code is written.