title: JQuery ajax/post - setting JSON in the data field causes JsonMappingException
body: <p>I am having issues sending a JQuery post to my server.  I have narrowed the problem down to the data field not being set correctly in my javascript, which leads to an exception: </p>
  
  <blockquote>
    <p>org.codehaus.jackson.map.JsonMappingException: Can not deserialize
    instance of com.myserver.rest.messages.dto.NewMessageDTO
    out of START_ARRAY token</p>
  </blockquote>
  
  <p>The code that <strong>works</strong>, but not very clean:</p>
  
  <pre><code>     $.ajax({
                 type: "POST",
                 url: "../resources/messages/",
                 data: '{"subject": "' + subject +
                       '", "message": "' + message +
                       '", "messageType": "' + type +
                       '", "employeeIDs": [' + employeeIDs +
                       '], "assignmentIDs": [' + assignmentIDs +']}',
                 contentType: "application/json",
                 success: successHandler,
                 error: defaultErrorHandler
              });
  </code></pre>
  
  <p>Which renders to:</p>
  
  <blockquote>
    <p>{"subject": "test", "message": "test", "messageType": "MESSAGE", "employeeIDs": [461,485], "assignmentIDs": [103]}</p>
  </blockquote>
  
  <p>The code that <strong>does not work</strong>, but is cleaner:</p>
  
  <pre><code>            $.ajax({
                 type: "POST",
                 url: "../resources/messages/",
                 data: {'subject': subject, 'message': message, 'messageType': type, 'employeeIDs[]': employeeIDs, 'assignmentIDs[]': assignmentIDs},
                 contentType: "application/json",
                 success: successHandler,
                 error: defaultErrorHandler
              });
  </code></pre>
  
  <p>Which is rendering as application/x-www-form-urlencoded for some reason:</p>
  
  <blockquote>
    <p>subject=test&amp;message=test&amp;messageType=MESSAGE&amp;employeeIDs%5B%5D=461&amp;employeeIDs%5B%5D=485&amp;assignmentIDs%5B%5D=103</p>
  </blockquote>
  
  <p>Any ideas what I am doing wrong here?  Thanks in advance for any help</p>