title: How to send a POST request with BODY in swift
body: <p>I'm trying to make a post request with a body in swift using Alamofire.</p>
  
  <p>my json body looks like :</p>
  
  <pre><code>{
      "IdQuiz" : 102,
      "IdUser" : "iosclient",
      "User" : "iosclient",
      "List":[
          {
          "IdQuestion" : 5,
          "IdProposition": 2,
          "Time" : 32
          },
          {
          "IdQuestion" : 4,
          "IdProposition": 3,
          "Time" : 9
          }
      ]
  }
  </code></pre>
  
  <p>I'm trying to make <code>let</code> <code>list</code> with NSDictionnary which look like :</p>
  
  <pre><code>[[Time: 30, IdQuestion: 6510, idProposition: 10], [Time: 30, IdQuestion: 8284, idProposition: 10]]
  </code></pre>
  
  <p>and my request using Alamofire looks like :</p>
  
  <pre><code>Alamofire.request(.POST, "http://myserver.com", parameters: ["IdQuiz":"102","IdUser":"iOSclient","User":"iOSClient","List":list ], encoding: .JSON)
              .response { request, response, data, error in
              let dataString = NSString(data: data!, encoding:NSUTF8StringEncoding)
                  println(dataString)
          }
  </code></pre>
  
  <p>The request has an error and I believe the problem is with Dictionary list, cause if I make a request without the list it works fine, so any idea ?</p>
  
  <hr>
  
  <p>I have tried the solution suggested but I'm facing the same problem :</p>
  
  <pre><code> let json = ["List":list,"IdQuiz":"102","IdUser":"iOSclient","UserInformation":"iOSClient"]
          let data = NSJSONSerialization.dataWithJSONObject(json, options: NSJSONWritingOptions.PrettyPrinted,error:nil)
          let jsons = NSString(data: data!, encoding: NSUTF8StringEncoding)
  
  
  
      Alamofire.request(.POST, "http://myserver.com", parameters: [:], encoding: .Custom({
          (convertible, params) in
          var mutableRequest = convertible.URLRequest.copy() as! NSMutableURLRequest
          mutableRequest.HTTPBody = jsons!.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
          return (mutableRequest, nil)
      }))
          .response { request, response, data, error in
          let dataString = NSString(data: data!, encoding:NSUTF8StringEncoding)
             println(dataString)
      }
  </code></pre>