title: How receive a list of JavaScript objects in a List<Object> in Spring MVC?
body: <p>I was reading a lot but I don't know what is the error in my code. I hope you can help me. Regards.</p>
  <p>Model: RenglonFacturaDTO(With his getters/setters)</p>
  <pre><code>public class RenglonFacturaDTO implements Comparable&lt;RenglonFacturaDTO&gt;{
  
     private Integer idfact;
     private Long idrenglon;
     private Integer idremito;
     private Float cant;
     private String descripadic;
     private Double precio;
     private Double subtotal;
  }
  </code></pre>
  <p>This is the list of objects that i send via ajax to controller</p>
  <pre><code>&lt;script&gt;
     $(document).ready(function(){
      
         var cliente = $('.id').data('id');
         var token = $(&quot;meta[name='_csrf']&quot;).attr(&quot;content&quot;);
         var header = $(&quot;meta[name='_csrf_header']&quot;).attr(&quot;content&quot;); 
         var listado = [{}];
        
  
        $('#generar').click(function(){
  
           cliente = $('#idcliente').data('id');
      
           $('.renglon').each(function(){
          
               elem = $(this);    
          
               cant = elem.find('.cant').val();
               precio = elem.find('.precio').val();
               descripadic = elem.find('.descripadic').val();
               idremito = elem.find('.idremito').text();
               idrenglon = elem.data('idrenglon');
               idfact = $('#factura').data('idfact');
               subtotal = cant * precio;
          
               listado.push({&quot;cant&quot;: parseFloat(cant),&quot;precio&quot;: precio ,&quot;descripadic&quot;:descripadic,&quot;subtotal&quot;:subtotal ,&quot;idremito&quot;:idremito ,&quot;idrenglon&quot;:idrenglon , &quot;idfact&quot;:idfact});
          
           });
  
         $.ajax({
            &quot;type&quot;:&quot;post&quot;,
            &quot;url&quot;:&quot;agregarRenglonesFactura&quot;,
            &quot;dataType&quot;: 'json',
            &quot;cache&quot;: false,
            &quot;data&quot;: {&quot;listado&quot;: listado},
            beforeSend: function(xhr) {
              // here it is
              xhr.setRequestHeader(header, token);
            }
          
           });
       });
   });
  &lt;/script&gt;
  </code></pre>
  <p>Controller</p>
  <pre><code>@RequestMapping(value=&quot;/agregarRenglonesFactura&quot;, method= RequestMethod.POST) 
  public String redAgregarRenglonFactura(@ModelAttribute ArrayList&lt;RenglonFacturaDTO&gt; renglonesfacturadto) throws Exception{
      
          Iterator&lt;RenglonFacturaDTO&gt; it = renglonesfacturadto.iterator();
          
          while(it.hasNext()){
          
              RenglonFacturaDTO renglonfacturadto = it.next();
          
          System.out.println(&quot;***************AGREGAR RENGLON*******************IDRENGLONREMITO: &quot; + renglonfacturadto.getIdrenglon() + &quot; CANTIDAD: &quot; + renglonfacturadto.getCant());
          }
          
          return (&quot;TAMAÑO LISTA: &quot; + renglonesfacturadto.size());
  }   
  </code></pre>
  <p>this is the error:</p>
  <pre><code> Request processing failed; nested exception is org.springframework.beans.InvalidPropertyException: 
  Invalid property 'listado[10][cant]' of bean class [ar.edu.grupoesfera.cursospring.modelo.ListadoRenglonesFacturaDTO]:
  Property referenced in indexed property path 'listado[10][cant]' is neither an array nor a List nor a Map; returned value was [ar.edu.grupoesfera.cursospring.modelo.RenglonFacturaDTO@67e12cdf]] con causa raíz
  </code></pre>
  <p>This is the array that i send via post</p>
  <pre><code>listado[0][cant]15
  listado[0][descripadic]
  listado[0][idfact]12
  listado[0][idremito]9
  listado[0][idrenglon]36
  listado[0][precio]135
  listado[0][subtotal]2025
  listado[1][cant]15
  listado[1][descripadic]
  listado[1][idfact]12
  listado[1][idremito]9l
  istado[1][idrenglon]36
  listado[1][precio]135
  listado[1][subtotal]2025
  listado[2][cant]15
  listado[2][descripadic]
  listado[2][idfact]12
  listado[2][idremito]9
  listado[2][idrenglon]36
  listado[2][precio]135
  listado[2][subtotal]2025
  </code></pre>