The number of posts is available in StackOverflow but i can't get the solution, I am using Alamofire Library and post my result to hit API but I'm not able to get the result please help me to fix it.
{
"People":{ "Prefix": "Mr.",
"FirstName": "Eric",
"MiddleName": null,
"LastName": "John",
"FullName": "Smith GOldi6",
"Email1": "abc123@example.com",
"Email2": null,
"PhoneNumber1": "0000",
"PhoneNumber2": null,
"DateOfBirth": "1975-01-01T00:00:00",
"Status": 3,
"DeleteFlag": true,
"Comments": null,
"Description": null,
"UserName": "abc123"
},
"Password": "password1"
}
this is the result which I create in parameters to post.
Alamofire.request(signup_api, method: .post, parameters: parameters, encoding: URLEncoding.httpBody).responseJSON { (response) in
switch response.result {
case .success(let data) :
let json = JSON(data)
print("response.result = \(response.result)")
print("response = \(response)")
let resJson = JSON(response.result.value!)
print("success = \(resJson)")
if (resJson.count == 0) {
if (resJson.null == nil) {
// self.DimBackground.isHidden = true
// self.activator.stopAnimating()
}
return
}
if let err = response.error{
print("err === \(err)")
return
}
return
case .failure(let _error):
print("_error = \(_error)")
print("false")
print("response.result = \(response.result)")
print("response = \(response)")
print("Network Problem: There might be an issue with your internet connection, or server not responding. Please try again.")
return
}
}
This shows this error:
_error = responseSerializationFailed(reason: Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(error: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.})) false response.result = FAILURE response = FAILURE: responseSerializationFailed(reason: Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(error: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.}))