如何使用Alamofire解析Swift 4中的JsonObject?
这是Json响应:
{"code":"1","ExhibitorData":{"ExhibID":"EXHIB_1","CompanyName":"Star Developers"}}
下面是Swift代码:
Alamofire.request(Url!, method : .post, parameters: parameters).responseString { response in
if let JSONResponse = response.result.value as? [String: Any]{
let Code = JSONResponse["code"] as! [String: Any]
//How do i parse the data from ExhibitorData here
}
}
如何解析参展商数据并将其存储在变量中?
我是Swift编程的新手
答案 0 :(得分:-2)
ExhibitorData在字典格式中,因此您可以使用以下代码-
let ExhibitorData = JSONResponse["ExhibitorData"] as! AnyObject