我正在使用 PHP 对大量多维事件数组进行 json 编码,所以我得到如下内容:
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},
第一个维度是 id,请参见
var ents = {"7":{
因此可以在不检查嵌套对象的情况下获取 id...
检查 JSON 是否包含 id 的最快、最有效的方法是什么?