i am trying to read external json file with fs and then log it but it does not work. In my json file i have only one array to read :
{
"tags": [ "blah", "blah1", "etc..."
]
}
and i am using async readFile function to read it
...
const tagsjson = require('../tags.json');
var tags;
...
fs.readFile(tagsjson, 'utf8', function(err,data){
if(err) throw err;
tags = data;
})
console.log(tags)
i don't know what is problem i tried JSON.parse(data) but it did not work too, and i am using raw data because, i want to send that tags to client after i read it.