My JSON file consists of a simple object containing 2 arrays:
{
"key1": ["a", "b", "c"],
"key2": [ "d", "e", "f"]
}
When using JavaScript, I fetch the data and push it into an array to use it.
const jsonData = '/things.json';
const myArray = [];
fetch(jsonData)
.then(answer => answer.json())
.then(data => myArray.push(data))
console.log(myArray); // This results in a nested array
console.log(myArray[0]); // Undefined
Looping through myArray also returns //undefined
Using spread syntax or concat leads to //Found non-callable @@iterator
How can I access the content of that array?