Can't access to a string in a nested object

Hello guys !

That’s surely something stupid I am missing here, building a plugin SSA action:

On console.log(data), I am getting the following object in the console: { Brand: [ { Name: 'Toy', Speed: 58.16352844238281, Tyres: [Array], Similarities: [] } ], BrandVersion: '2.0' }

I want to extract the string ‘Toy’, so I am using the dot notation:

console.log(data.Brand) returns [ { Name: 'Toy', Speed: 58.16347122192383, Tyres: [ [Object] ], Similarities: [] } ], so far so good, continuing with the dot notation:

But console.log(data.Brand.name) returns undefined :roll_eyes:

Am I missing something here ?

Brand[0].name (because brand is an array … you can see it with [])
0 will return first item of the array

I have always thought I needed to adjust my glasses :rofl:

Thanks !!

1 Like