title: How to detect missing field when converting jsonObject to Model Object
body: <p>I am sending a <code>JsonObject</code> using web service. The method that receives the call has a method parameter of model Object for the corresponding  <code>JsonObject</code> Input being passed. The  <code>JsonObject</code> is successfully getting converted to model object but I am not able to test a few of my Responses from the model Object. </p>
  
  <p>For example: if any mandatory field is missing in the input JSON or if any field in the input JSON is set to <code>null</code>, then in both these cases the model object field is coming out to be <code>null</code>.</p>
  
  <p>I am not able to detect if the <code>null</code> is because of field missing or the field being set to <code>null</code>.</p>
  
  <p>Can anybody suggest me a solution?</p>
  
  <p>My last way out for this is, I will receive method parameter input as <code>String</code> and not my model Object and then using conditional checks, check the input string and get my Responses accordingly. But my JSON input object is very large and I am hoping there could be a better way out than this.</p>
  
  <p>It is a Spring boot project. </p>
  
  <p>Code Snippet:</p>
  
  <pre><code>JSON Object being sent
  
  {"orgType":null, "orgLocation": "Geneva" , //other fields}
  
  
  @RequestMapping(value="/addOrganizations", method= RequestMethod.POST)
  public ResponseEntity addOrganization(@RequestBody Organization organization){
  // code goes here
  }
  </code></pre>
  
  <p>If I try with </p>
  
  <pre><code>{"orgType":null, "orgLocation": "Geneva" , //other fields}
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>{"orgLocation": "Geneva" , //other fields}
  </code></pre>
  
  <p>and check with debugger inside <code>addOrganization()</code> method, then the value is <code>null</code> in both the cases.</p>
  
  <p>Model class:</p>
  
  <pre><code>public class Organization{
  
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  private String orgType;
  
  private String orgLocation;
  
  // other fields and getters and setters.
  
  }
  </code></pre>