Skip to content
Advertisement

Get to second level array in JSON

im more of a designer and less of a programmer so any help is greatly appreciated. The idea behind this project is to generate a dropdown menu using the “name” from the data json and when selected the “stock” information will appear as well. I’ve been able to get to the “name”:”Pantone 12345″ but when i try to access the name of the stocks i get and error saying it can’t find property “name”

here is my json

JavaScript

here is the code im using to create the dropdown

JavaScript

the var dataStock error out because i can’t get to the stocks name.

Advertisement

Answer

this way ?

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement