I know I must be missing something very basic here, but I could do with a pair of fresh eyes.
I have an array of objects (see code).
I'm trying to read the values of property variants of each object.
I've tried many combinations. For one, if I do object.variants or object[0].variants, the result is undefined.
Can anybody tell me why please?
Update: I need to loop through the objects in the array and check, for each of them, the variants property. If it's not null then grab its values and log them.
[
{
"type": "text",
"complete": true,
"startPoint": {
"x": 233.84,
"y": 82.13
},
"endPoint": {
"x": 461.27,
"y": 79.74
},
"text": "xvxvs xsvx vx",
"variants": [
"xvxvs",
"xsvx",
"vx"
]
},
{
"type": "text",
"complete": true,
"startPoint": {
"x": 515.39,
"y": 120.84
},
"endPoint": {
"x": 803.67,
"y": 111.31
},
"text": "casdc adcasdcasc",
"variants": [
"casdc",
"adcasdcasc"
]
}
]
arr, then it would bearr[0].variants.