title: Post array of objects with Alamofire and SwiftyJSON
body: <p>I have an array of dictionaries that I am trying to post to Alamofire with the help of SwiftyJSON.</p>
  
  <p>The api is set to take: </p>
  
  <pre><code>[
      {
          "imageUrl": "someimage3.jpg"
      },
      {
          "imageUrl": "someimage4.jpg"
      }
  ]
  </code></pre>
  
  <p>My array with image objects when printed out looks like this with the imageUrl key and image name for the value.</p>
  
  <pre><code>uploadedFiles = [
      [imageUrl: "someimage.jpg"],
      [imageUrl: "someimage2.jpg"]
  ]
  </code></pre>
  
  <p>I'm trying to convert the array of dictionaries into the format needed for the body. I'm not quite sure how to get them to be [String: AnyObject]</p>
  
  <pre><code>var body: [String: AnyObject] = [:]
  let paramsJSON = JSON(uploadedFiles)
  body = paramsJSON
  </code></pre>
  
  <p>alamofire post</p>
  
  <pre><code>Alamofire.request("\(BASE_URL)mainimages/\(someid)", method: .post, parameters: body, encoding: JSONEncoding.default, headers: header).responseString { (response) in
          if response.result.error == nil {
              let status = response.response?.statusCode
              completion(true, status)
          } else {
              completion(false, nil)
              debugPrint(response.result.error as Any)
          }
      }
  </code></pre>