I have a file that contains data in json format.
{
"channelName" : "practice",
"startDate" : ISODate("2017-07-22T06:29:35.681Z"),
"endDate" : ISODate("2017-08-22T06:29:35.681Z")
}
Above is the file format. Filename is test.json. I want to read it at my server side and insert into db. I tried using Assets.getText but failed reading the file in json format. Following is the code i wrote
Assets.getText('channelTestData.json', function(err, res){
// var test = JSON.parse(res);
// console.log('tets : ' + test);
Channel.insert(res);
// Channel.save(res);
});
If i use JSON.parse or EJSON.parse, it throws an error.