使用Swift请求JSON Alamofire序列化失败
我有以下内容: 我正在向Alamofire发出HTTP请求以检索此内容。 这是我的密码:使用Swift请求JSON Alamofire序列化失败,json,swift,http,alamofire,Json,Swift,Http,Alamofire,我有以下内容: 我正在向Alamofire发出HTTP请求以检索此内容。 这是我的密码: Alamofire.request("https://example.com/Student/Grade/GetFinalGrades") .responseJSON(completionHandler: { response in print(response)
Alamofire.request("https://example.com/Student/Grade/GetFinalGrades")
.responseJSON(completionHandler: {
response in
print(response)
})
但是当我打印响应时,我得到了以下错误:
FAILURE: responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 198."
UserInfo={NSDebugDescription=Invalid value around character 198.}))
这很奇怪,因为JSON文件看起来很干净。有什么想法吗?谢谢
“iconCls”:X.net.RM.getIcon(“BulletWhite”),
:这看起来不像是有效的JSON。我如何绕过它?请您的服务发送一个真正的JSON?如果不是(也不推荐),那就是黑客攻击。黑客:使用reponseString(不是JSON),搜索X.net.RM.getIcon(“某物”)
,并将其替换为“某物”,将其转换回(NS)数据,并使用自己的NSJSONSerialization。如何将其协调回NSData?这似乎是一个好主意