How do I configure a default format for Instant or LocalDateTime values when using Jackson3 #360
-
|
I tried to configure a default DateFormat format on the JsonMapper, but this one is not used by Instant objects. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
Installing a module has barely changed. JsonMapper.builder.addModule. |
Beta Was this translation helpful? Give feedback.
-
|
Java 8 Date/Time, including But do not try registering and so on for other types |
Beta Was this translation helpful? Give feedback.
Java 8 Date/Time, including
Instantis built-in for Jackson 3. Note thatDateFormatis only forjava.util.Date/Calendar; Java 8 types cannot use that class for config.But do not try registering
Instanthandlers separately; Config Overrides withJsonFormat.Value.forPattern()is the way to go. I do not remember call off-hand but there are unit tests for it, f.exsrc/test/java/tools/jackson/databind/ext/javatime/deser/InstantDeserTest.java:and so on for other types