title: Problems with Spring RestTemplate Post for Object with String
body: <p>I've been struggling to solve this issue here, and i can't find what i am doing wrong.</p>
  
  <p>I am trying to make a simple JSON Post, using Spring RestTemplate, and sending all information as String to be simple all the way around as follows:</p>
  
  <pre><code>RestTemplate restTemplate = new RestTemplate();
  
  JSONObject issue = getJSONIssue(redmine);
  try {
      String response = restTemplate.postForObject(redmineProperties.getUrl()+"/issues.json?key="+redmineProperties.getKey(), issue.toJSONString(), String.class);
  }catch(RestClientException e){
      e.printStackTrace();
  }
  </code></pre>
  
  <p>My JSONObject looks like:</p>
  
  <pre><code>{"issue":
      {"priority_id":4,
       "description":"asdasdasdasd",
       "subject":"adasdad",
       "project_id":4
       }
   }
  </code></pre>
  
  <p>This is the data i am trying to sendo via Post, and the server keep sending me the error:</p>
  
  <pre><code>    [http-bio-8080-exec-7] WARN org.springframework.web.client.RestTemplate - POST request for "http://xxx.com.br/issues.json?key=b8143da980578fee4db0b33bd3cd3eec511797d6" resulted in 422 (Unprocessable Entity); invoking error handler
  org.springframework.web.client.HttpClientErrorException: 422 Unprocessable Entity
      at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
      at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:589)
      at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:547)
      at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:503)
      at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:331)
      at br.com.cubbes.docmidia.controller.redmine.RedmineController.saveUser(RedmineController.java:101)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
  </code></pre>
  
  <p>when i send the same data via a client like insomnia by Google Chrome, the servers resolves without a problem.</p>
  
  <p>Do anyone know what i could be doing wrong here?</p>