title: Ajax POST Array of Objects to Spring MVC Controller - Multiple Errors
body: <p>I need to submit a JS-formed Array of Objects to a Spring MVC Controller. All the property names match.</p>
  
  <pre><code>@PostMapping("/addAdmin")
  public void addAdmin(@RequestParam List&lt;UserRolesGUIBean&gt; userRolesGUIBeans)
  {
      // ...      
  }   
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code> var entries = [];
   //...
   // entries is an array of objects of the form {id: "..", role: ".."}
   // verified to be correct before submission
  
   $.ajax({
          type : "post",
          dataType : "json", 
          url : 'addAdmin',  
          data : JSON.stringify(entries)
   })
  </code></pre>
  
  <p>Bean</p>
  
  <pre><code>public class UserRolesGUIBean implements Serializable {
      private String id;
      private String role;
      // + Constructors (Empty + Full), Getters and setters
  }
  </code></pre>
  
  <p>Error:</p>
  
  <p><code>Required List parameter 'userRolesGUIBeans' is not present]</code></p>
  
  <p>Also tried this with <code>ModelAttribute</code> and an <code>ArrayList</code>,</p>
  
  <pre><code>PostMapping("/addAdmin")
      public void addAdmin(@ModelAttribute ArrayList&lt;UserRolesGUIBean&gt; userRolesGUIBeans)  {
  </code></pre>
  
  <p>Now there are no errors, <strong>but the list is empty, no data was received</strong>.</p>
  
  <p>Tried everything -- arrays vs. lists, <code>JSON.stringify(data)</code> or a data object with <code>data {"entries" : entries}</code>, <code>RequestBody</code> doesn't work and gives UTF Errors; and <code>RequestParam</code> as above doesn't work either.</p>
  
  <p>This is way too complicated for a simple task.</p>