Alamofire json encoded post request
3 answers
Have you tried the following?
var parameter = ["abc": [1,2,3]]
Alamofire.request(.POST, "http://www.yoursite.com/api" , parameters:parameter)
I would also look at the Alamofire github documentation , which is really helpful.
+1
source to share
another solution from the official documentation.
let parameters = [
"foo": "bar",
"baz": ["a", 1],
"qux": [
"x": 1,
"y": 2,
"z": 3
]
]
Alamofire.request(.POST, "http://httpbin.org/post", parameters: parameters)
// HTTP body: foo=bar&baz[]=a&baz[]=1&qux[x]=1&qux[y]=2&qux[z]=3
I don't understand how to validate your server data on your server, but I think you can validate your abc result as string [1,2,3]
let parameters = [
"abc": "[1,2,3]"
]
]
0
source to share