title: How to send an array to a web api with Angular2 and Typescript
body: <p>I can't manage to send an array to a web api with Angular2. In my Typescript I'm calling the api with this:</p>
  
  <pre><code>apiData(command?: string | null, array?: string[] | null): Observable&lt;void&gt; {
      //let url_ = this.baseUrl + "/api/Data/command?";
      let url_ = "/api/Data/command?";
  
      if (command !== undefined)
          url_ += "command=" + encodeURIComponent("" + command) + "&amp;";
      url_ = url_.replace(/[?&amp;]$/, "");
  
      //const content_ = JSON.stringify(array);
  
      if (array !== undefined)
          array &amp;&amp; array.forEach(item =&gt; { url_ += "array=" + encodeURIComponent("" + item) + "&amp;"; });
  
  
  
      let options_: any = {
          //data: content_,
          method: "post",
          headers: new Headers({
              "Content-Type": "application/json",
          })
      };
  </code></pre>
  
  <p>And the Api looks like this:</p>
  
  <pre><code>    [Produces(typeof(void))]
      [HttpPost("command")]
      public HttpResponseMessage PostData(string command, string[] array)
      {
  </code></pre>
  
  <p>When using the above example the api receives the correct amount rows in the array but they are all "[object Object]".</p>
  
  <p>If I use JSON.stringify(array) and send it through as Data: (commented out in my example) the web api only gets an empty string. The array I'm sending through is JSON.</p>
  
  <p>This approach worked in Angularjs but for some reason I can't get this to work.</p>