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 question's didn't helped me:
- How to tell Jackson to ignore empty object during deserialization?
- How to ignore "null" or empty properties in json, globally, using Spring configuration
Update 1:
I'm using Jackson 2.9.6