var jsonData = [{"person":"me","age":"30"},{"person":"you","age":"25"}];
for(var i in jsonData){
var key = i;
var val = jsonData[i];
for(var j in val){
var sub_key = j;
var sub_val = val[j];
console.log(sub_key);
}
}
EDIT
var jsonObj = {"person":"me","age":"30"};
Object.keys(jsonObj); // returns ["person", "age"]
Object
has a property
keys
, returns an Array
of keys from that Object
Chrome, FF & Safari supports Object.keys
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…