I have a problem using swift because I need to send a Json
like this:
{
"package": {
"description": "Pink iPad",
"contentValue": 120.01,
"weight": 1.01,
"length": 30.01,
"height": 15.01,
"width": 20.01
},
"origin_zip_code": "44100",
"destination_zip_code": "44510"
}
That's my attempt to do that:
let package : [String: Any?] = [
"description": "Pink iPad",
"contentValue": 120.0,
"weight": 1.01,
"length": 30.01,
"height": 15.01,
"width": 20.01
]
parameters = [
"package": package,
"origin_zip_code": "44100",
"destination_zip_code": "44510"
]
When I got a response from Alamofire I have the following message:
failure(Alamofire.AFError.responseSerializationFailed(reason: Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(error: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.})))
What's wrong with it? Thank you so much for reading