title: Spring controller how to get and convert JQuery dataTable aoData into Java object
body: <p>I have this js code:</p>
  
  <pre><code>                table = $('#searchResultTable').dataTable(
                      {
                          "destroy" : true,
                          "bProcessing" : true,
                          "bServerSide" : true,
                          "sDom" : 'trtip',
                          "sPaginationType" : "full_numbers",
                          "sServerMethod" : "POST",
                          "sEmptyTable" : "No Entity Profile found",
                          "iDisplayLength" : searchBO.pagination.pageSize,
                          "sAjaxSource" : "search.jax",
  
                          "fnServerParams" : function(aoData) {
                              aoData.push({
                                  "name" : "searchBO",
                                  "value" : searchBO
                              });
                          },
                          "fnServerData" : function(sSource, aoData,
                                  fnCallback, oSettings) {
                              oSettings.jqXHR = $.ajax({
                                  "contentType" : "application/json",
                                  "dataType" : "json",
                                  "url" : sSource,
                                  "type" : "post",
                                  "data" : aoData,
                                  "success" : fnCallback,
                                  "error" : function(a, b, c) {
                                      alert("error!");
                                  }
                              });
                          },
                          "fnRowCallback" : function(nRow, aData,
                                  iDisplayIndex) {
                              $('td:eq(1)', nRow).html(
                                      '&lt;a href="viewProfile-'
                                              + aData.encEntityId + '.htm"&gt;'
                                              + aData.entityId + '&lt;/a&gt;');
                              return nRow;
                          }
                      });
  </code></pre>
  
  <p>searchBO would be something like this:</p>
  
  <pre><code>var searchBO = {
      "pagination" : pagination,
      "individual" : individual,
      "organization" : organization,
      "enrollmentId" : enrollmentId,
      "medicareId" : medicareId,
      "npi" : npi,
      "contractId" : contractId,
      "firstName" : firstName,
      "lastName" : lastName,
      "ssn" : ssn,
      "dob" : dob,
      "licenseNumber" : licenseNumber,
      "licenseState" : licenseState,
      "specialtyType" : specialtyType,
      "licenseExpirationDate" : licenseExpirationDate,
      "businessName" : businessName,
      "ein" : ein,
      "organizationType" : organizationType,
      "city" : city,
      "state" : state,
      "zipCode" : zipCode,
      "startDate" : startDate,
      "endDate" : endDate
  }
  </code></pre>
  
  <p>On Chrome debug mode, I can see the data I'm passing to server is:</p>
  
  <pre><code> Request Payload
   sEcho=1&amp;iColumns=2&amp;sColumns=%2C&amp;iDisplayStart=0&amp;iDisplayLength=1&amp;mDataProp_0=0&amp;sSearch_0=&amp;bRegex_0=false&amp;bSearchable_0=true&amp;bSortable_0=true&amp;mDataProp_1=1&amp;sSearch_1=&amp;bRegex_1=false&amp;bSearchable_1=true&amp;bSortable_1=true&amp;sSearch=&amp;bRegex=false&amp;iSortCol_0=0&amp;sSortDir_0=asc&amp;iSortingCols=1&amp;searchBO=%5Bobject+Object%5D
  </code></pre>
  
  <p>Now I'm a little confuse about what the best way is for Spring controller to parse this data into a Java Object, Is this possible?I would like my controller something like this:</p>
  
  <pre><code>    @RequestMapping(value = "/search.jax", method = RequestMethod.POST)
  @ResponseBody
  public Object doSearch(@RequestBody SearchRequestJSON searchRequestJSON,
          HttpServletRequest request, HttpServletResponse response)
          throws APSException {
      SearchResponseJSON json = new SearchResponseJSON();
      return json;
  }
  </code></pre>
  
  <p>I've figured out the SearchResponseJSON.java would look like:</p>
  
  <pre><code>import java.util.List;
  public class SearchResponseJSON {
  private int sEcho;
  private int iTotalRecords;
  private int iTotalDisplayRecords;
  private List&lt;EntityProfileVO&gt; aaData;
  
  
  
  public int getiTotalDisplayRecords() {
      return iTotalDisplayRecords;
  }
  
  public void setiTotalDisplayRecords(int iTotalDisplayRecords) {
      this.iTotalDisplayRecords = iTotalDisplayRecords;
  }
  
  
  public int getiTotalRecords() {
      return iTotalRecords;
  }
  
  public void setiTotalRecords(int iTotalRecords) {
      this.iTotalRecords = iTotalRecords;
  }
  
  public int getsEcho() {
      return sEcho;
  }
  
  public void setsEcho(int sEcho) {
      this.sEcho = sEcho;
  }
  
  public List&lt;EntityProfileVO&gt; getAaData() {
      return aaData;
  }
  
  public void setAaData(List&lt;EntityProfileVO&gt; aaData) {
      this.aaData = aaData;
  }
  }
  </code></pre>
  
  <p>I'm very not sure what the SearchRequestJSON.java needs to be like.I'm hoping in the controller @RequestBody can convert aoData from front-end into searchRequestJSON object.
  thanks for any help.</p>