Do not include empty object to Jackson
问题 I am trying to create json with spring boot. class: public class Person { private String name; private PersonDetails details; // getters and setters... } impletentation: Person person = new Person(); person.setName("Apple"); person.setDetails(new PersonDetails()); So there is a instance of Person with empty details and this is exactly what Jackson is returning: "person": { "name": "Apple", "details": {} } I want to have json without empty brackets {} : "person": { "name": "Apple" } This