Send an array as a parameter in a Alamofire POST request
<p>My app is currently using AWS API Gateway and Alamofire to access different lambda functions that act as my backend. </p>

<p>I have the need to send an array as one of the parameters to one of those API end points, for that I am using the following code:</p>

<pre><code>        var interests : [String]
        interests = globalInterests.map({ (interest) -&gt; String in
            return interest.id!
        })

        // Parameters needed by the API
        let parameters: [String: AnyObject] = [
            "name" : name,
            "lastName" : lastName,
            "interests" : interests
        ]


        // Sends POST request to the AWS API
        Alamofire.request(.POST, url, parameters: parameters, encoding: .JSON).responseJSON { response in

            // Process Response
            switch response.result {

            case .Success:

                print("Sucess")

            case .Failure(let error):
                 print(error)
            }
        }
</code></pre>

<p>But that is not working because of the array is not being recognized by the API, but if I create a "static" array </p>

<pre><code>let interests = ["a", "b", "c"] 
</code></pre>

<p>Everything works as it is supposed to.</p>

<p>How can I fix this situation given that the array of interests come from another part of the code, how should I declare it or construct it?</p>

<p>A friend managed to accomplish this in Android using an </p>

<pre><code>ArrayList&lt;String&gt;
</code></pre>

<p>EDIT:</p>

<p>Printing the parameters array shows me this:</p>

<pre><code>["name":test, "interests": &lt;_TtCs21_SwiftDeferredNSArray 0x7b05ac00&gt;( 103, 651, 42), "lastName": test]
</code></pre>