这是我的目标:
family_Data = {
"Family": [
{
"id": "Family-15",
"members":
{
"Family-15-01": [{"Family Code": "Family-15-01","Gender": "Female", "Full Name" : "Evelyn Osei"}],
"Family-15-02": [{"Family Code": "Family-15-02","Gender": "Male", "Full Name" : "David Will"}],
"Family-15-03": [{"Family Code": "Family-15-03","Gender": "Male", "Full Name" : "Edwin Pan"}]
}
}
]
}
我想循环使用"成员"对象。
答案 0 :(得分:0)
首先获取您的members
对象。
var members = family_Data.Family[0].members;
然后迭代对象。
for(var key in members){
var member = members[key];
// here we go.
}
答案 1 :(得分:0)
var family_Data = {
"Family": [
{
"id": "Family-15",
"members": {
"Family-15-01": [{"Family Code": "Family-15-01","Gender": "Female", "Full Name" : "Evelyn Osei"}],
"Family-15-02": [{"Family Code": "Family-15-02","Gender": "Male", "Full Name" : "David Will"}],
"Family-15-03": [{"Family Code": "Family-15-03","Gender": "Male", "Full Name" : "Edwin Pan"}]
}
}
]
};
for(var key in family_Data.Family[0].members){
console.log(family_Data.Family[0].members[key]);
}