title: Getting Exception while trying to parse JSON Object from AJAX call to Java
body: <p>**</p>
  
  <p>Updated Code</p>
  
  <p>**</p>
  
  <p><strong>My Javascript/Ajax Code:</strong></p>
  
  <pre><code>$(function() {
          $("#create_obd").bind("click", function(event) {
  
              var soNumber = [];
  
               $('#sales_order_lineItems input[type=checkbox]:checked').each(function(index) { 
  
                 var row = $(this).parent().parent();
                 var rowcells = row.find('td');
  
                  var soRowData = {
                         so_number:rowcells[1].innerText
                      };
                 soNumber.push(soRowData);
  
               }); //loop ends
  
              var soNumbers = JSON.stringify(soNumber);
              alert(soNumbers);
               $.ajax({
                      type: "POST",
                      url: server_ip_address + "/createobdaction",
                      data: soNumbers,
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      success: function(data){alert(data);},
                      failure: function(errMsg) {
                          alert(errMsg);
                      }
                  });
              });
      });
  </code></pre>
  
  <p><strong>My Java Code:</strong></p>
  
  <pre><code>package com.app.action;
  
  import java.util.List;
  
  import com.app.bean.SONumber;
  
  public class CreateOBDAction {
  
  private List&lt;SONumber&gt; soNumbers;
  
  public String createOBD() {
      System.out.println(soNumbers.size());
      return "jsonCreateOBDSuccess";
  }
  
  public List&lt;SONumber&gt; getSoNumbers() {
      System.out.println("Getter................");
      return soNumbers;
  }
  
  public void setSoNumbers(List&lt;SONumber&gt; soNumbers) {
      System.out.println("Setter............");
      this.soNumbers = soNumbers;
  }
  
  }
  </code></pre>
  
  <p><strong>Bean Class</strong></p>
  
  <pre><code>package com.app.bean;
  
  public class SONumber {
  
      String soNumber;
  
      public String getSoNumber() {
          return soNumber;
      }
  
      public void setSoNumber(String soNumber) {
          this.soNumber = soNumber;
      }
  }
  </code></pre>
  
  <p><strong>Struts.xml</strong></p>
  
  <pre><code>&lt;action name="createobdaction" class="com.app.action.CreateOBDAction" 
        method="createOBD"&gt;
      &lt;interceptor-ref name="defaultStack"/&gt;
      &lt;interceptor-ref name="json"&gt;
          &lt;param name="enableSMD"&gt;true&lt;/param&gt;
      &lt;/interceptor-ref&gt;       
      &lt;result name="jsonCreateOBDSuccess" type="json" /&gt;
  &lt;/action&gt;
  </code></pre>
  
  <p><strong>Exception</strong></p>
  
  <blockquote>
    <p>15:32:00,092 ERROR JSONInterceptor:34 - Unable to deserialize JSON
    object from request 15:32:00,093 DEBUG Dispatcher:80 - Exception
    occurred during processing request: Unable to deserialize JSON object
    from request org.apache.struts2.json.JSONException: Unable to
    deserialize JSON object from request  at
    org.apache.struts2.json.JSONInterceptor.intercept(JSONInterceptor.java:117)</p>
  </blockquote>