title: How to tell Jackson to ignore a Object with EMPTY or NULL fields during serialization?
body: <p>I know about these annotations @JsonInclude(JsonInclude.Include.NON_NULL) and @JsonInclude(JsonInclude.Include.EMPTY) but in my case it's doesn't work.</p>
  
  <p>My case is: </p>
  
  <p>I have some class (entity (SomeClass)) with some other entity inside (SomeObject)</p>
  
  <pre><code>    @Data
      public class SomeClass {
          private String fieldOne;
          @JsonInclude(JsonInclude.Include.NON_NULL)
          private String fieldTwo;
          @JsonInclude(JsonInclude.Include.NON_NULL)
          private SomeObject someObject;
      }
  </code></pre>
  
  <p>Entity - SomeObject</p>
  
  <pre><code>@Data
  public class SomeObject {
      @JsonInclude(JsonInclude.Include.NON_NULL)
      private String name;
  }
  </code></pre>
  
  <p>Main class</p>
  
  <pre><code>public class Main {
      public static void main(String[] args) throws JsonProcessingException {
          SomeClass someClass = new SomeClass();
          someClass.setFieldOne("some data");
  
          SomeObject someObject = new SomeObject();
          someObject.setName(null);
          someClass.setSomeObject(someObject);
  
          ObjectMapper objectMapper = new ObjectMapper();
          String someClassDeserialized = objectMapper.writeValueAsString(someClass);
          System.out.println(someClassDeserialized);
      }
  }
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>{"fieldOne":"some data","someObject":{}}
  </code></pre>
  
  <p>The final output should be, without object (SomeObject) with null or empty fields:</p>
  
  <pre><code>{"fieldOne":"some data"}
  </code></pre>