I am reading a json file in nodejs and want to find a specific key in the json object before doing things with it:
fs.readFile('./output.json', 'utf8', function(err, data) {
if (err) throw err;
console.log(Object.keys(data));
});
Problem is, it returns an array of numbers as strings:
[ '0',
'1',
'2',
'3',
'4'
... ]
When my json file has text like this. Why is this happening?
[{
"id": "vdhbsasqzqnbx2od",
"message": "On Sun, Jan 1, 2012 at 8:17 AM, Alan Stern <ste...@rowland.harvard.edu> wrote:As Linus pointed out, the real problem here
}, { ...
}]
via agomez
No comments:
Post a Comment