title: Sending array of objects via POST not working - Angular
body: <p>I cannot send an array of <code>FormGroup</code> objects to my backend. </p>
  
  <p><strong>Error</strong>: It says: <code>"Unsupported Media Type" "Content type 'text/plain;charset=UTF-8' not supported"</code> error 415.</p>
  
  <hr>
  
  <p>Previously, it could not deserialize the array into my Java object in my backend because it was not in JSON format, and now I am stuck with this.</p>
  
  <p>I have tried to use <code>JSON.stringify(arrayOfFormGroups)</code> to convert it to JSON, but I do not know why it says I am sending <code>plain/text</code>.</p>
  
  <hr>
  
  <p>This code gives you the content type error.</p>
  
  <p><strong>TS</strong></p>
  
  <pre><code>// Inserts all the form data into one array
  let dataArray: String[] = [this.form1.value, this.form2.value, this.form3.value, this.form4.value];
  
  // Send the form data to the service, which then sends the data to the server (Spring-Boot)
  this.data.sendFormData(JSON.stringify(dataArray)).subscribe(
        response =&gt; console.log("Success! ", response),
        error =&gt; console.error("Error: ", error)
      );
  }
  </code></pre>
  
  <p>This code makes the array undeserializable for consumption in the backend.</p>
  
  <p><strong>TS</strong></p>
  
  <pre><code>// Inserts all the form data into one array
  let dataArray: String[] = [this.form1.value, this.form2.value, this.form3.value, this.form4.value];
  
  // Send the form data to the service, which then sends the data to the server (Spring-Boot)
  this.data.sendFormData(dataArray).subscribe(
        response =&gt; console.log("Success! ", response),
        error =&gt; console.error("Error: ", error)
      );
  }
  </code></pre>
  
  <p><strong>Service</strong></p>
  
  <pre><code>sendFormData(userData) {
     return this.http.post&lt;any&gt;("http://localhost:8080/create", userData);
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Expected</strong></p>
  
  <p>I want to POST my array of FormGroups to my backend as JSON String.</p>
  
  <p><strong>Actual</strong></p>
  
  <p>An error occurs when I POST, unsupported <code>content-type plain/text</code> even though I am sending JSON.</p>