I've been attempting to extract information from my JSON data, but I keep getting an undefined result.
Here is a snippet of my JSON:
{
"1": "A",
"2": "B",
"3": "C",
"4": "D",
"5": "E",
"6": "F",
"key":"pair"
}
This is how I'm parsing the data:
rawdata = fs.readFileSync('data.json');
data = JSON.parse(rawdata);
console.log(data.1) //returns undefined. I even tried converting 1 to a String with no luck.
console.log(data.key) //outputs pair