title: Alamofire POST not working as expected. Error on parameters
body: <p>I am trying to upload (post) a JSON string using Alamofire and I'm getting an error that leads me to believe there is some issue in the dictionary encoding.</p>
  <p>The array I am encoding is an array of objects, all of type String. It looks like this:</p>
  <pre><code>class SavedDeliveries: Codable { //not sure if this is the issue (I use this to store default values locally)
      var fullName = &quot;&quot;
      var address = &quot;&quot;
      var city = &quot;&quot;
      var zip = &quot;&quot;
      var phone = &quot;&quot;
      var orders = &quot;&quot;
      var ordersListed = &quot;&quot;
      var pickup = &quot;&quot;
  }
  </code></pre>
  <p>The code including the Alamofire call looks like this:</p>
  <pre><code>func postData() {
     let headers: HTTPHeaders = [
     &quot;Content-Type&quot;: &quot;application/json&quot;,
     &quot;X-Master-Key&quot;: &quot;xxx&quot;, //API Key
     &quot;X-Bin-Name&quot;: &quot;deliverydata&quot;]
  
     let jsonEncoder = JSONEncoder()
     let jsonData = try! jsonEncoder.encode(deliveryList)
     let json = String(data: jsonData, encoding: String.Encoding.utf8)
     print(json!) // printing the JSON and it is correct when validated.
  
     AF.request(&quot;https://api.jsonbin.io/v3/b&quot;, method: .post, parameters: json, encoding: JSONEncoding.default, headers: headers).responseString { (response) in
        switch response.result {
           case .success:
              print(&quot;was successful&quot;)
           case let .failure(error):
              print(error)
        }
     }
  }
  </code></pre>
  <p>I expect it to upload the JSON file but I'm getting an error message that says this:</p>
  <pre><code>Cannot convert value of type 'String?' to expected argument type 'Parameters?' (aka 'Optional&lt;Dictionary&lt;String, Any&gt;&gt;')
  </code></pre>
  <p>Not sure if the AF call parameter is expecting a certain kind of dictionary key:value format. If this is not the right call format for uploading JSON, what do I need to change?</p>
  <p>Thanks for any help. I'm not a full-time Swift developer but manage an app that is usually within my capabilities. This one has me stumped.</p>