我正在检索使用此代码的数据
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"
答案 0 :(得分:0)
使用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
}
}