{"title" : "saved users", "saved_users_list" :
[
{"username" : "Danny7", "name" : "Danny", "email" : "[email protected]"},
{"username" : "Ike2016", "name" : "Ike", "email" : "[email protected]"},
{"username" : "john202", "name" : "John", "email" : "[email protected]"},
{"username" : "ray_mundo", "name" : "Raymundo", "email" : "[email protected]"}
]
}
我想解析這個與SwiftyJSON的JSON,它不工作。如何用SwiftyJSON解析這個json示例?
json["saved_users_list"].count == 0
json["saved_users_list"][0]["username"] does not equal "Danny7"
json["title"] == null
這裏就是我得到的數據:
Alamofire.request(.POST, url, parameters: parameters).validate().responseString { response in
switch response.result {
case .Success:
if let value = response.result.value {
value = JSON(value)
print(value)
}
}
打印(值)打印上面列出的JSON。
您可以分享您的代碼到目前爲止嗎? (例如,你如何解析JSON?你怎麼知道它看起來像你在這裏共享的?) – smarx
哦,是的,它可能是我沒有正確地將字符串轉換爲json – walton