我用这个代码检索数据
Alamofire.request(urlString, method: .post, parameters: parameters,encoding: JSONEncoding.default, headers: headers) .responseString() { response in switch response.result { case .success(let data): let jsonData = JSON(data) print(jsonData) case .failure(let error): print("\(error) - hello world") } }
服务器发送的结果是
{"result":"Opertion is successfull"}
但我只想要有价值的部分 "Opertion is successfull"
"Opertion is successfull"
使用almofire的代码 documentation
Alamofire.request(urlString, method: .post, parameters: parameters,encoding: JSONEncoding.default, headers: headers) .responseString() { response in if let jsonData = response.result.value { print("JSON: \(jsonData)") // serialized json response } }