I'm trying to read the data from my json with below format but it results with undefined
My JSON as below
{
"1": "A",
"2": "B",
"3": "C",
"4": "D",
"5": "E",
"6": "F",
"key":"pair"
}
I'm parsing as below
rawdata = fs.readFileSync('data.json');
data = JSON.parse(rawdata);
console.log(data.1) //returns undefined. I tried parsing 1 to String but resulted same.
console.log(data.key) //returns pair
[]notation to get values in an object likedata["1"]