Facing json serilization exception for below code , any help is appreciated.
let headers: HTTPHeaders = [
"Authorization": "XXXXXX",
"Accept": "application/json",
"Content-Type": "application/json"
]
let body: Parameters = [
"test_id": 1,
"stud_id": 1,
"delayed_mins": 5
]
Alamofire.request("http://cloud.xxx/api/notify",method: .post,parameters: body,encoding: JSONEncoding(options: []),headers: headers).responseJSON { response in
print(response)
print(response.result)
print(response.result.isSuccess)
}
Any help is really appreciated.
I tried passing string like below
let body: Parameters = [
"test_id": "abc",
"stud_id": "def",
"delayed_mins": "ghi"
]
It works , may be having issue passing integers in json . Any help would really appreciated.
changing from responseJSON to responseString worked, closing the issue.
very helpful, thanks a lot
Most helpful comment
changing from responseJSON to responseString worked, closing the issue.