family = {
'person1':[{"id":"1111","name":"adam", "sex":"male", "born":"USA"}],
'person2':[{"id":"2222","name":"sarah", "sex":"female", "born":"Canada"}],
'person3':[{"id":"3333","name":"adam", "sex":"male", "born":"USA"}]
};
鉴于上面的家庭对象,我如何提取具有特定 id(或名称)值的人员对象之一的所有属性(id、姓名、性别、出生)?例如 id=1111
所以理想情况下,我可以获得一个可以操作的新对象 personInQuestion,其中:
personInQuestion = {"id":"1111","name":"adam", "sex":"male", "born":"USA"}