(note: this is retroactive issue -- actual removal done before 3.0.0-rc1 release)
(note: inspired by #5269)
With 3.0, ObjectMapper becomes immutable: this is achieved by removing all setXxx() methods (and other mutators). This includes setSerializationInclusion().
The replacement for:
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
is
ObjectMapper mapper = JsonMapper.builder()
.changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_NULL))
.build();
OR for also content (of arrays, Collections, Maps);
ObjectMapper mapper = JsonMapper.builder()
.changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_NULL)
.withContentInclusion(JsonInclude.Include.NON_NULL)
)
.build();
(note: this is retroactive issue -- actual removal done before
3.0.0-rc1release)(note: inspired by #5269)
With 3.0,
ObjectMapperbecomes immutable: this is achieved by removing allsetXxx()methods (and other mutators). This includessetSerializationInclusion().The replacement for:
is
OR for also content (of arrays,
Collections,Maps);