I tried to Iterate json data in txt file using file(fs) module.its json data is string format but I want object format.how to achieve it.
amd.txt
{
"first_name":"iball"
}
{
"first_name":"ibell"
}
product.js
fs.readFile("amd.txt","utf8", (err, data) => {
if (err) throw err;
let student = JSON.stringify(data);
student = JSON.parse(student
console.log(typeof student)
});
Current output
string
excepted output
object