How is it possible to configure the Micronaut Serde objectMapper to include all properties when serializing, and not just the non-null values?
For Jackson the similar code looks like this:
new com.fasterxml.jackson.databind.ObjectMapper()
.setSerializationInclusion(JsonInclude.Include.ALWAYS)
Sample:
@Test
void testObjectMapper() throws IOException {
var name = new Name("My first", null);
var expected = """
{"first":"My first", "last": null}
""";
var json = ObjectMapper.getDefault().writeValueAsString(name);
assertEquals(expected, json);
}
@Introspected
@Serdeable
public record Name(String first, String last) {
}
I want the json to be
{"first":"My first", "last": null}
and not just
{"first":"My first"}