title: Alamofire Passing Parameter With Common Keys and Multiple Values?
body: <p>I need to do this in my project:</p>
  <p>I can do this easily if I manually append strings to my URL in Alamofire, but I don't want that. I want the parameters as <strong>Parameter</strong> object.</p>
  <p><strong>multiple values in one common key for parameter</strong></p>
  <p><a href="https://i.stack.imgur.com/8FWtR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8FWtR.png" alt="enter image description here" /></a></p>
  <p>What I've been doing:</p>
  <pre><code>public func findCreate(tags: [String], withBlock completion: @escaping FindCreateServiceCallBack) {
      
      /* http://baseurlsample.com/v1/categories/create_multiple?category_name[]=fff&amp;category_name[]=sss */
      
      let findCreateEndpoint = CoreService.Endpoint.FindMultipleCategories
      
      let parameters: Parameters = [&quot;category_name[]&quot; : tags]
      
      Alamofire.request(
          findCreateEndpoint,
          method: .post,
          parameters: parameters,
          encoding: URLEncoding(destination: .queryString),
          headers: nil
          ).responseJSON { (response) in
              print(response)
      }
  //....
  }
  </code></pre>
  <p>The current result if I run this is okay but the values sent to the server has [&quot; &quot;]. For example:</p>
  <pre><code>[&quot;chocolate&quot;]
  </code></pre>
  <p>Again, the questions are, in which part of my whole code I'm wrong? How can I send parameters like the above that have one common key and multiple values?</p>
  <p>I also have tried adding <strong>encoding</strong> option to the <strong>Alamofire.request()</strong> If I add <code>encoding: JSONEncoding.prettyPrinted</code> or <code>encoding: JSONEncoding.default</code> I get <strong>status code 500</strong>.</p>
  <p>Some links that have the same question but no exact answers, I always see posts that have answers like using a custom encoding and that's it.</p>
  <ul>
  <li><p><a href="https://github.com/Alamofire/Alamofire/issues/570" rel="nofollow noreferrer">https://github.com/Alamofire/Alamofire/issues/570</a></p>
  </li>
  <li><p><a href="https://stackoverflow.com/questions/31910683/moya-alamofire-url-encoded-params-with-same-keys">Moya/Alamofire - URL encoded params with same keys</a></p>
  </li>
  </ul>
  <p>Additional info:</p>
  <p>This works, but I need to send multiple String:</p>
  <pre><code>let parameters: [String : Any] = [&quot;category_name[]&quot; : tags.first!]
  </code></pre>
  <p>And this works as well:</p>
  <pre><code>Alamofire.request(&quot;http://baseurlsample.com/v1/categories/create_multiple?category_name[]=fff&amp;category_name[]=sss&quot;, method: .post).responseJSON { (data) in
      print(data)
  }
  </code></pre>