title: @RequestBody not mapping JSON to Java Object - Spring Boot
body: <p>I am unable to convert my JSON from post's method body into my POJO, with <code>@RequestBody</code> inside my controller class.</p>
  
  <p>I debugged the error and I saw that certain fields were mapped and others were not. Like this <strong>(POJO)</strong>:</p>
  
  <p><code>name: null, typeOfPlan: null, Email: example@gmail.com, PhoneNum: 123456789, Website: test.org, Username: null, password: 1234</code>, which is strange.</p>
  
  <p><strong>JSON:</strong> </p>
  
  <pre><code>{
      "confirmPassword": "1234",
      "email": "example@gmail.com",
      "password": "1234",
      "phoneNum": "123456789",
      "name": "Hello world",
      "typeOfPlan": "Test",
      "userName": "user",
      "website": "test.org"
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.CrossOrigin;
  import org.springframework.web.bind.annotation.PostMapping;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RestController;
  
  @RestController
  public class SomeController {
  
      @Autowired
      private Service foo;
  
      @CrossOrigin
      @PostMapping(value = "/create")
      private void createAccount(@RequestBody BigFoo bigFoo) {
          foo.createAccount(bigFoo);
      }
  }
  </code></pre>
  
  <p>From here, I call my service, then DAO classes.</p>
  
  <p><strong>POJO</strong></p>
  
  <pre><code>import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  import lombok.Getter;
  import lombok.NoArgsConstructor;
  import lombok.Setter;
  
  @Getter
  @Setter
  @NoArgsConstructor
  @JsonIgnoreProperties(ignoreUnknown = true)
  public class BigFoo {
  
      private String name;
      private String typeOfPlan;
      private String email;
      private String website;
      private String phoneNum;
      private String username;
      private String password;
  }
  </code></pre>
  
  <hr>
  
  <p>I have also tried to allow JSON with <code>consumes media type</code> in the <code>@PostMapping</code>, but it failed it solve this.</p>
  
  <p>Using Jackson ObjectMapper did not work as well.</p>