Hello!
So, I’m trying to get data from a JSON file, where the data was saved as an array. But when I try to retrieve discrete values, they come back as ‘undefined’.
Can you help? What am I doing wrong?
let locJ = 'designs.json';
jL = loadJSON(locJ);
console.log(jL.boxs[0].e);
Console = Cannot read property ‘0’ of undefined
This is what the successfully(?) saved JSON file looks like (generated from p5 code):
{
"boxs": [
{
"x": 73.1,
"y": 73.1,
"r": 34.4,
"gX": 1,
"gY": 1,
"h": false,
"p": false,
"e": false
},
{
"x": 73.1,
"y": 107.5,
"r": 34.4,
"gX": 1,
"gY": 2,
"h": false,
"p": false,
"e": false
},
{
"x": 73.1,
"y": 141.89999999999998,
"r": 34.4,
"gX": 1,
"gY": 3,
"h": false,
"p": false,
"e": false
},
**etc**
Thanks for any help
B