how do i see if a big JSON object contains a value?
Posted
by Haroldo
on Stack Overflow
See other posts from Stack Overflow
or by Haroldo
Published on 2010-06-11T08:13:25Z
Indexed on
2010/06/11
8:23 UTC
Read the original article
Hit count: 325
I'm using PHP to json encode a massive multi-dimensional array of events, so i get something like this:
var ents = {"7":{"event_id":"7","nn":"The Whisky Drifters","nn_url":"the-whisky-drifters","venue":"The Grain Barge","date_num":"2010-06-11","date_txt":"Friday 11th June","gig_club":"1","sd":"A New Acoustic String Band...","ven_id":"44","art":0},"15":{"event_id":"15","nn":"Bass Kitchen","nn_url":"bass-kitchen","venue":"Timbuk2","date_num":"2010-06-11","date_txt":"Friday 11th June","gig_club":"2","sd":"Hexadecimal \/ DJ Derek \/ Id","ven_id":"21","art":1},
the first dimension is the id, see
var ents = {"7":{
So its possible to get the ids without examining the nested objects...
What's the fastest, most efficent way to check if my JSON contains an id?
© Stack Overflow or respective owner