Reputation: 11
i am trying go convert my json array in to simple (numbered)values. getting them from database(.find), the problem is they are not converting with json.parse. am i doing something wrong?
Voltage.find({},function (err, data) {
var jsontext = data;
var parsedData = JSON.parse(jsontext);
res.json(parsedData);
console.log(parsedData);
});
ths is the console.log for the session, i was hoping for just: 333, 333, 333 etc.
[{"_id":"56f3c19a0298308405d60464","temp":333,"__v":0},{"_id":"56f3c1ee7ec57884068dcb2c","temp":333,"__v":0},{"_id":"56f3c4467ec57884068dcb2d","temp":333,"__v":0},{"_id":"56f3d80191a3c68c138bf04d","temp":337,"__v":0},{"_id":"56f3da3f06cefa781763fb21","temp":337,"__v":0}]
it is the temp values i am trying to get out to send to my front end only. i am using mongooose, express.js and node.js with a mongodb also. thanks for looking.
Upvotes: 0
Views: 536