title: Spring MVC: Not able to submit form data in JSON format
body: <p>Getting following exception while doing so.</p>
  
  <pre><code>HandlerMethod details: 
  Controller [application.entry.controller.UserController]
  Method [public java.lang.String application.entry.controller.UserController.handleSave(java.util.List&lt;java.util.Map&lt;java.lang.String, java.lang.String&gt;&gt;)]
  
  org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded' not supported
      at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:124)[org.springframework.web.servlet-3.1.1.RELEASE.jar:3.1.1.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:91)[org.springframework.web.servlet-3.1.1.RELEASE.jar:3.1.1.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:71)[org.springframework.web.servlet-3.1.1.RELEASE.jar:3.1.1.RELEASE]
  </code></pre>
  
  <p><strong>Controller Class:</strong></p>
  
  <pre><code>@RequestMapping(value="/save", method=RequestMethod.POST)
  @ResponseBody public String handleSave(@RequestBody List&lt;Map&lt;String, String&gt;&gt; client)
      {
          Map&lt;String, String&gt; formInputs = new HashMap&lt;String, String&gt;();
  
          for (Map&lt;String, String&gt; formInput : client) {
              formInputs.put(formInput.get("name"), formInput.get("value"));
          }
  </code></pre>
  
  <p>I did try with <code>@RequestMapping(value="/save", method=RequestMethod.POST, headers = "Accept=application/json")</code> also but error is same.</p>
  
  <p><strong>spring-servlet.xml</strong></p>
  
  <pre><code>&lt;bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"&gt;&lt;/bean&gt;
       &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
      &lt;property name="messageConverters"&gt;
        &lt;list&gt;
          &lt;ref bean="jacksonMessageConverter"/&gt;
        &lt;/list&gt;
      &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p><strong>jQuery Submit:</strong></p>
  
  <pre><code>$('form').submit(function () {
                      alert();
                      $.ajax({
                          url: $(this).attr('action'),
                          type: 'POST',
                          data: JSON.stringify($(this).serializeArray()),
                          contentType: 'application/json',
                          success: function (data) {
                              alert('data')
                          },
                          error: function (jqXHR, textStatus, errorThrown) {
                              alert('An error has occured!! :-(')
                          }
                      })
  
                      return false
                  })
  </code></pre>