Having class like this
@AllArgsConstructor @NoArgsConstructor @Getter @Setter public final class ActiveRecoveryProcess { private UUID recoveryId; private Instant startedAt; } I'm getting com.fasterxml.jackson.databind.exc.InvalidFormatException with message Cannot deserialize value of typejava.time.Instantfrom String "2020-02-22T16:37:23": Failed to deserialize java.time.Instant: (java.time.format.DateTimeParseException) Text '2020-02-22T16:37:23' could not be parsed at index 19
JSON input
{"startedAt": "2020-02-22T16:37:23", "recoveryId": "6f6ee3e5-51c7-496a-b845-1c647a64021e"} Jackson configuration
@Autowired void configureObjectMapper(final ObjectMapper mapper) { mapper.registerModule(new ParameterNamesModule()) .registerModule(new Jdk8Module()) .registerModule(new JavaTimeModule()); mapper.findAndRegisterModules(); } EDIT
JSON is generated from postgres
jsonb_build_object( 'recoveryId', r.recovery_id, 'startedAt', r.started_at ) where r.started_at is TIMESTAMP.
Instantis being used over the whole project. Why should I consider usingLocalDateTimeoverInstant?2020-02-22T16:37:23, without aZat the end, how do you know for sure that the time is in UTC? Perhaps usingLocalDateTimewould be more appropriate for such a time value without time zone.jsonb_build_object()function