javascript - JSON/JS- Getting JSON object name -


i have following object consisting of 3 other objects of type array :

enter image description here

i want text samsung out of object , rest of objects. have tried using in loop getting keys 0, 1 , 2.

for(brand in brands){  console.log(brand)  // prints out `0, 1 , 2` }  

so added nested in loop, 0, 0, 0 keys within samsung, , other array objects within rest of objects.

what missing ?

you can use object.keys(brands[brand]), and, based on example, want object.keys(brands[brand])[0]


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -