title: How to POST JSON data using NSURLSession in swift
body: <p>I am stuck with the below code. How do I set the param and in post method?</p>
  
  <pre><code>let params:[String:Any] = [
          "email" : usr,
          "userPwd" : pwdCode]
  
  let url = NSURL(string:"http://inspect.dev.cbre.eu/SyncServices/api/jobmanagement/PlusContactAuthentication")
  let request = NSMutableURLRequest(URL: url!)
  request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
  
  request.HTTPBody = params&lt;what should do for Json parameter&gt;
  
  
  let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
      data, response, error in
  
      if let httpResponse = response as? NSHTTPURLResponse {
          if httpResponse.statusCode != 200 {
              println("response was not 200: \(response)")
              return
          }
      }
      if error {
          println("error submitting request: \(error)")
          return
      }
  
      // handle the data of the successful response here
  }
  task.resume()
  </code></pre>