How can I read this file 'file.json':
{
"name": "MyName"
}
and get json without comment?
I am using this code:
var fs = require('fs');
var obj;
fs.readFile('./file.json', 'utf8', function (err, data) {
if (err) throw err;
obj = JSON.parse(data);
});
it returns this error:
SyntaxError: Unexpected token
Is there npm some package to solve this issue?
source
share