【发布时间】:2016-11-14 12:07:51
【问题描述】:
request( url!, method: .get, parameters: nil)
.responseJSON { response in
print(response.result) // result of response serialization
if let newJSON = response.result.value {
let json = JSON(newJSON)
for (key,subJson):(String, JSON) in json {
let age = subJson["age"]
let name = subJson["name"]
let status = subJson["status"]
//the code below looks kind of confusing if it gets longer
if age == "22"{
if status == "highschool "{
if name == "Leo"{
//do something with the result
有没有更好的方法来检查 JSON 的结果是否与字符串相同?
【问题讨论】:
标签: json xcode if-statement swift3