title: Alamofire 'invalid type in JSON write' error after upgrading
body: <p>The following code was working with Alamofire 3.0:</p>
  
  <pre><code>let headers = [
      "content-type": "application/json",
      "cache-control": "no-cache",
      ]
  let parameters = [
      "access_token": token.tokenString,
      "client_id": bundleID,
  ]
  
  Alamofire.request(.POST, url, headers: headers, parameters: parameters, encoding: .JSON).responseJSON { response in
      // ...
  }
  </code></pre>
  
  <p>I changed the request after updating to Alamofire 4.0/Swift3/XCode 8:</p>
  
  <pre><code>Alamofire.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { response in
      // ...
  }
  </code></pre>
  
  <p>And I get the error</p>
  
  <p><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (_SwiftValue)'</code></p>
  
  <p>I've been looking for a solution to this problem but can't find anything relevant.</p>