JSON data : {
"8500500561":{
"food":"400",
"cloth":"44",
"travel":"44"
}
}
I'll get the key value to access the JSON data dynamically
Node.js file :
const fs = requrie('fs');
let rawdata = fs.readFileSync('data.json');
let mydata = JSON.parse(rawdata);
mob = '8500500561';
console.log(mydata.mob.food);
but when I use this I'm getting an error : TypeError: Cannot read property 'food' of undefined