title: org.springframework.http.converter.HttpMessageNotReadableException when sending a POST request
body: <p>I have a Spring application with the following controller:</p>
  
  <pre><code>   @RestController
     @RequestMapping("/app") 
     public class RegisterRestController {
     @Autowired
      UserRepository userRepository;
  
     @Autowired
     PasswordEncoder passwordEncoder;
  
     @Autowired
     UserService userService;
  
  
     @RequestMapping( value="/loginuser", method =RequestMethod.POST,produces="application/json")
      public String loginUser(@RequestBody String requestBody) {
      System.out.println("inside");
      JSONObject responseJsonObject = new JSONObject();
      String phonenumber;
      String password;
      try{
          JSONObject object = new JSONObject(requestBody);
          phonenumber = object.getString("phonenumber");
          password = object.getString("password");
          User user = userService.findByNumber(phonenumber);
          String sha256Password = passwordEncoder.encode(password);
          if(sha256Password.equals(user.getPassword())){
              responseJsonObject.put("response", "Login Successful");
          }
          else {
              responseJsonObject.put("repsonse", "Login failed");
          }
      }
      catch (Exception e){
          e.printStackTrace();
          try {
              responseJsonObject.put("response", "Invalid Credentials");
          } catch (JSONException e1) {
              e1.printStackTrace();
          }
  
      }
      return responseJsonObject.toString();
  }
  </code></pre>
  
  <p>However, when I send a POST request from Postman containing : </p>
  
  <pre><code>    {
        "phonenumber":"9123456789",
        "password":"password"
    }
  </code></pre>
  
  <p>I get the following response:</p>
  
  <pre><code>    {
     "timestamp": 1456043810789,
     "status": 400,
      "error": "Bad Request",
      "exception":      "org.springframework.http.converter.HttpMessageNotReadableException",
      "message": "Could not read JSON: Can not deserialize instance of   java.lang.String out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@eaa3acb; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@eaa3acb; line: 1, column: 1]",
      "path": "/app/loginuser"
  }
  </code></pre>
  
  <p>Also, I was experimenting with Spring Security as well. The server does not show any error and the controller does not seem to receive the request as "inside" is not being printed. I am trying to get acquainted with Spring, however I could not find the reason for such an error. I would be grateful for any help. Thanks in advance </p>