0
我是ruby的新手,並且在循環嵌套的哈希和數組時遇到困難。來自深層嵌套哈希和數組的循環特定值
說我有以下的JSON:
{
"Resume":{
.... data ....
},
"StructuredXMLResume":{
"ContactInfo":{
.... data ....
}
]
},
"EmploymentHistory":{
"EmployerOrg":[
{
"EmployerOrgName":"ABC Corp.",
"PositionHistory":[
{
.... data ....
]
},
{
"EmployerOrgName":"National Geo.",
"PositionHistory":[
{
.... data ....
}
]
}
]
}
]
}
。
resume.["Resume"]["StructuredXMLResume"]["EmploymentHistory"]["EmployerOrg"][0]["EmployerOrgName"]
給我ABC Corp.
和
resume.["Resume"]["StructuredXMLResume"]["EmploymentHistory"]["EmployerOrg"][1]["EmployerOrgName"]
給我National Geo.
如何循環打印每EmployerOrgName
?
我也應該使用'each'或'map'?我對兩者之間的差異感到困惑。 – cruisertom