I have this JSON (this is a simplified version):
{
"from":0,
"location": [{
"city":"Barcelona"
}]
}
And i'm trying to do an Alamofire request with this JSON on parameters. So I have typed something like this:
let parameter = [
"from":0,
"location": [
["city": "Barcelona"]
]
]
But it seems Alamofire doesn't accept the parse from [{ }] to [[]] on parameters. I have read that one way to solve this is using a MutableURLRequest but i don't find any clear example.
Alamofire.request(.GET, "http://myurl", parameters: (params as! [String : AnyObject]), headers: nil).responseCollection { (response: Response<[Group], NSError>) in
switch response.result {
case .Success(let groups):
print("Success")
case .Failure(_):
print("Failure")
}
}
This code above works and I get a result from this Alamofire Request but ignores this:
"location": [ ["city": "Barcelona"]]
Could someone can help with that? Thank you so much.