I am trying to execute a GET requst with a json object attached to it. It's me how I created a JSON object
let jsonObject: [String: AnyObject] = [
"ean_code": [
"type": "match",
"value": "16743799"
]
]
and then I fulfilled the request
like this
Alamofire.request(.GET,Constant.WebClient.WS_URL + "/product?filters="+String(jsonObject),parameters:parameters)
but this gave me an error that binds the URL to an invalid character
so I encoded the url from this
let request = String(jsonObject).stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLPasswordAllowedCharacterSet())!
this will encode the url, but again I will give me the following error
Error request: Error Domain = NSCocoaErrorDomain Code = 3840 "Invalid value around character 0." UserInfo = {NSDebugDescription = Invalid value around character 0.}
so my question is how to associate a json object with a GET URL?
source
share