Beginner at both JSON and javascript. I need a way to return the key subAttributeOne
it self from a list of object instead of his value.
Following is example of a list,
var list =
[
{
attribute1: "value",
attribute2:[{subAttributeOne:"value",subAttributeTwo:"value"},{}]
},
//other objects
{..}
]
I have tried following,
list[0].attribute2[1].subAttributeOne
it returns value
but the result I need is subAttributeOne
With this:
Object.keys(list[0].attribute2[0])
you get
['subAttributeOne', 'subAttributeTwo']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With