I am using Java 17, spring-boot 2.6.3 with spring-webflux and spring-consul dependencies and I have the following class: Here’s my custom serializer. And my models are as simples as this: I can’t annotate my model class with @JsonSerialize(using = ModelSerializer.class) because it is in a dependency that I am not allowed to modify. I know I did wrote the code
Tag: jackson-modules
Jackson , java.time , ISO 8601 , serialize without milliseconds
I’m using Jackson 2.8 and need to communicate with an API that doesn’t allow milliseconds within ISO 8601 timestamps. The expected format is this: “2016-12-24T00:00:00Z” I’m using Jackson’s JavaTimeModule with WRITE_DATES_AS_TIMESTAMPS set to false. But this will print milliseconds. So I tried to use objectMapper.setDateFormat which didn’t change anything. My current workaround is this: I’m overriding the default serializer for