Json – How to make Jackson deserialize explicit null to Optional.EMPTY, but not to serialize empty Optional as null
Assuming I have a POJO like this: public static class Test { private Optional<String> something; } And a Jackson mapper like this: var OBJECT_MAPPER = JsonMapper.builder() .addModule(new Jdk8Module()) .serializationInclusion(JsonInclude.Include.NON_ABSENT) .build(); If I deserialize the JSON string {"something": null}, I get…