I\'m having a bit of trouble structuring my parameters so that our server API would be able to read it as valid JSON.
Alamofire uses parameters like this in swift la
In my case.
let query = "blm"
let allCountriesParameter = ["country": "*"]
let jsonObject: [String: Any] = ["query": query, "locations": [allCountriesParameter]]
let httpBody = try JSONSerialization.data(withJSONObject: jsonObject)
How it looks.
print(String(data: httpBody, encoding: .utf8))
{
"query":"blm",
"locations":[
{
"country":"*"
}
]
}