I have JSON as follows which has to be included as body for POST request,
{
"type" : "myData",
"condition" : {"projectid": 40}
}
How should my POST request be formed using Alamofire?
You need to simply create parameter Dictionary
.
let parameters: [String:Any] = [ "type" : "myData", "condition" : ["projectid" : 40]]
Now pass this parameters
dictionary with Alamofire
.
Alamofire.request(urlString, method: .post, parameters: parameters, encoding: JSONEncoding.default).responseJSON { response in
print(response)
}