Given this array:
var a = [
{
"name": "Konji-fu",
"bananas": [
{
"url": "//url1",
"num": 16
},
{
"url": "//url2",
"num": 16
}
]
},
{
"name": "Salias",
"bananas": [
{
"url": "//url4",
"num": 16
},
{
"url": "//url12",
"num": 3
}
]
}
]
How can I check that it contains a bananas
key?
Bonus question : How can I check for the presence of both a bananas
key and an url
key inside it?
EDIT :
var p = JSON.parse(a)
I tried testArray = 'feeds' in p
, jQuery.inArray('feeds', p)
and well, a lot of other stuff, see answers below. I just can't seem to check the keys in this particular array ; But feel free to downvote if you don't have the answer ;p