0
我在這裏有一種情況。我在這裏有一個對象,它嵌套在另一個對象中,在這裏我想選擇鍵。對象如下所示從嵌套對象中選擇密鑰
var x={
"_shards": {
"total": 10,
"successful": 5,
"failed": 0
},
"_all": {
"primaries": {
"indexing": {
"index_total": 4,
"index_time_in_millis": 5,
"index_current": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0
}
},
"total": {
"indexing": {
"index_total": 4,
"index_time_in_millis": 5,
"index_current": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0
}
}
},
"indices": {
"get56_name": {
"primaries": {
"indexing": {
"index_total": 4,
"index_time_in_millis": 5,
"index_current": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0
}
},
"total": {
"indexing": {
"index_total": 4,
"index_time_in_millis": 5,
"index_current": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0
}
}
}
}
}
如何選擇鍵即「get56_name」作爲答案。我不想要的價值,我想選擇關鍵我怎麼能得到它?
你是什麼意思「的意思是我不想要價值?「那麼你將如何處理對象呢? – 2014-09-23 06:09:11
你想要什麼輸出 – 2014-09-23 06:13:06
可能重複[如何列出JavaScript對象的屬性](http://stackoverflow.com/questions/208016/how-to-list-the-properties-of-a-javascript-object ) – JJJ 2014-09-23 06:13:57