Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed #1942

Closed
badrinathvm opened this issue Jan 30, 2017 · 3 comments

Comments

@badrinathvm
Copy link

badrinathvm commented Jan 30, 2017

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.

Uploading Screen Shot 2017-01-30 at 7.10.08 PM.png…

@badrinathvm
Copy link
Author

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.

@badrinathvm
Copy link
Author

changing from responseJSON to responseString worked, closing the issue.

@h4x0rMadness
Copy link

very helpful, thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants