我有这个散列,其中有一个数组:
{
"id": "0001001",
"name": "Bob Fisher",
"work": [
{
"employer": {
"id": "6883542487",
"name": "Marvel"
},
"location": {
"id": "108081209214649",
"name": "Las Vegas, Nevada"
},
"position": {
"id": "148835345140954",
"name": "Cirkusdirektör"
},
"description": "API testing",
"start_date": "2012-01",
"end_date": "2013-01"
},
{
"employer": {
"id": "11648563484",
"name": "DC Comics"
},
"location": {
"id": "108424279189115",
"name": "New York, New York"
},
"position": {
"id": "178387758878908",
"name": "Dykare"
},
"description": "Api testing",
"start_date": "2010-02",
"end_date": "2011-01"
}
]
}
如何在 ruby 中迭代每个雇主的价值观?所以我得到这样的输出:
Employer name: Marvel
Location name: Las Vegas, Nevada
Position: Cirkusdirektör
Description: Api testing
Start-date: 2012-01
End-date: 2013-01
Employer name: DC Comics
Location name: New York, New
Position: Cirkusdirektör
Description: Api testing
Start-date: 2012-01
End-date: 2011-01