title: Jackson Serialize: Include empty string if any
body: <p>I am trying to serialize a class into JSON string with jackson.</p>
  <p>Class</p>
  <pre><code>public class Response {
  
  
    @JsonProperty(&quot;status&quot;)
    private Short status;
  
    @JsonProperty(&quot;data&quot;)
    @JsonRawValue
    private String data;
  
    @JsonProperty(&quot;message&quot;)
    @JsonRawValue
    private String message;
    
  }
  </code></pre>
  <p>Using the following code to serialize</p>
  <pre><code>JsonFactory jsonFactory = new JsonFactory();
  jsonFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET,false);
  ObjectMapper mapper;
  mapper = new ObjectMapper(jsonFactory);
  mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
  mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
  mapper.findAndRegisterModules();
  
  Response responseInstance = new Response();
  responseInstance.setStatus((short) 400);
  responseInstance.setMessage(&quot;&quot;);
  System.out.println(mapper.writeValueAsString(responseInstance));
  </code></pre>
  <p>I am getting the following value while serialization when value of message is &quot;&quot;.</p>
  <pre><code>{
     &quot;status&quot;: 400,
     &quot;message&quot;:
  }
  </code></pre>
  <p>Instead of</p>
  <pre><code>{
     &quot;status&quot;: 400,
     &quot;message&quot;:&quot;&quot;
  }
  </code></pre>
  <p>When the value is null, it is skipped from serialization which is expected. But when the value is &quot;&quot;, i want that value be part of the serialization.
  How do i inlcude &quot;&quot; in the value while serialization?</p>