【发布时间】:2016-05-18 16:19:28
【问题描述】:
"groups" : {
"232" : {
"name" : "John",
"age" : "22"
}
},
"143" : {
"name" : "Dylan",
"age" : "22"
}
}
如何使用 swiftyJSON 获取“名称”?我得到了 id 值,但 ["name"] 的代码总是为零:
for (results,subJson):(String, JSON) in json["groups"] {
let id = results
print(id) //--> 232
let name = subJson["\(id)"]["name"].string
print(name) //--> nil
}
【问题讨论】:
标签: json swift swifty-json