I'm trying to read an array of strings out of a JSON file, and I seem to be able to load in the JSON array but I'm failing to actually access the data within. My JSON file looks like:
{
"insults": [" string 1", " string 2", " string 3" ]
}
The javascript trying to read the array in the main.js file looks like:
var insults = require("./insults.json");
console.log(insults);
console.log(insults[0]);
The console returns the JSON array for the first log, but returns undefined when I try to call the specific location within the array. Is there some function I'm missing to read from the array, or am I missing some steps in between?