title: How to pass json string as parameter in swift
body: <p>How to pass json as parameter string. I have tried by passing json as below but it throws error like <code>AuthenticateUser: Invalid JSON primitive</code>.</p>
  
  <pre><code>let jsonString = "{\"user\":\"usr\",\"password\":\"pass\"}"
  
          var urlStr = "http://testserver/AuthenticateUser?data=\(jsonString)"
  
  
          var url = NSURL(string: urlStr)
          let request = NSMutableURLRequest(URL: url!)
          request.URL = url
          request.HTTPMethod = "POST"
          request.addValue("application/xml", forHTTPHeaderField: "Content-Type")
          request.addValue("application/xml", forHTTPHeaderField: "Accept")
  
          let task = NSURLSession.sharedSession().dataTaskWithRequest(request)
              {
                  (data, response, error) in
  
                  var error: NSError?
                  if data != nil {
                      var reply = NSString(data: data!, encoding: NSUTF8StringEncoding)
                      println("reply &gt;&gt; \(reply)")
                  }
          }
          task.resume()
  </code></pre>