title: How Jackson deserialize a Input Map object in Spring Boot Controller
body: <p>I have this simple controller that receives a map as input:</p>
  
  <pre><code>@RequestMapping(value = "/providers", method = RequestMethod.PATCH, headers = "Accept=application/json")
      @ResponseBody
      @Transactional
      public Map&lt;String, Object&gt; updateProvider(@RequestBody Map&lt;String, Object&gt; updates,
              UriComponentsBuilder uriComponentsBuilder, final HttpServletRequest request) {
          return updates;
      }
  </code></pre>
  
  <p>and I have this property configured in Spring Boot in the <code>application.properties</code> file:</p>
  
  <pre><code>spring.jackson.default-property-inclusion=non_empty
  </code></pre>
  
  <p>Then, if I make a <em>PATCH</em> request with following JSON object.</p>
  
  <pre><code>{
      "name":"frndo",
      "lastname":""
  }
  </code></pre>
  
  <p>The content of result in the <em>RESPONSE</em> is:</p>
  
  <pre><code>{
    "name":"frndo"
  }
  </code></pre>
  
  <p>But the content of input in the <em>REQUEST</em> is:</p>
  
  <pre><code>{
      "name":"frndo",
      "lastname":""
  }
  </code></pre>
  
  <p>My question is, Why the content in the <em>REQUEST</em> is different in the <em>RESPONSE</em> if to serialize the Map object you have a global configuration like:</p>
  
  <p><code>spring.jackson.default-property-inclusion=non_empty</code></p>
  
  <p>Precisely why when <code>@RequestBody Map&lt;String, Object&gt; updates</code> arrives have the <code>name</code> and <code>lastname</code> fields if <code>lastname</code> is empty?. </p>
  
  <p>In the <em>RESPONSE</em> you can see the effect of the configuration but in the <em>REQUEST</em> is not seen. What is the explanation of this, if the mapper had to convert the JSON to a java object, and in that process the global configuration had to be applied? </p>
  
  <p>I expected to have the same content in the <em>REQUEST</em> and the <em>RESPONSE</em></p>
  
  <p>Many thanks!</p>