title: How to handle the json object sent as parameter in post request using $.ajax(); and rest webservices
body: <p>I am sending a json object in post request using jquery ajax as below.</p>
  
  <pre><code>$.ajax({
     url:'example/test/do',
     type:'POST',
     cache: false,
      dataType: 'text',
      data : [{id:'22',name:'hari'},{id:'32',name:'sharat'}],
      contentType : 'application/json',
      success : function(response) {
          alert(response);
      }
  });
  </code></pre>
  
  <p>And i have a bean as below</p>
  
  <pre><code>class User{
      private String id;
      private String name;
      //getters and setters
  }
  class UserList{
      private List&lt;User&gt;  userList;
      //getter setter comes here
  }
  </code></pre>
  
  <p>And the method to handle request</p>
  
  <pre><code>@POST
  @PATH('/test/do')
  @Produces(MediaType.TEXT_PLAIN)
  @Consumes(MediaType.APPLICATION_JSON)
  public Response acceptUsers(@Form UserList list){
      System.out.println(list.getUserList().size()); // i am getting zero    
    //actual code comes here
  }
  </code></pre>
  
  <p>I am sorry i am getting list as null and when i use size it obviously throws NullPointerException.</p>
  
  <p>How to receive the sent information of users into list of User objects, basically mapping/converting the json object to List of Pojo.</p>