Remove empty JSON objects from an array in Jackson serialization
问题 I have a List in a Java Pojo class. That list contains some MyChildPojo objects which are not null but can have properties with null values. Example: MyChildPojo obj1 = new MyChildPojo(); MyChildPojo obj2 = new MyChildPojo(); I have added @JsonInclude(JsonInclude.Include.NON_EMPTY) on my MyChildPojo class so null properties will not be added while serializing the object. Now my final serialized output for the List object is: [ {}, {} ] I want to remove the complete List object in this case. I