Jackson deserialize ISO8601 formatted date-time into Java8 Instant

后端 未结 5 1964
傲寒
傲寒 2021-02-03 18:02

I\'m trying to deserialize an ISO8601 formatted date into Java8 java.time.Instant using Jackson. I registered JavaTimeModule with the ObjectMapper, and turned off t

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-03 18:32

    The format "Z" does not work with "+01:00" as this is a different pattern. JsonFormat is using SimpleDateFormat patterns. "Z" in upper case only represents strict RFC 822. You have to use syntax like: "+0100", without colon.

    See: ISO 8601:2004, SimpleDateFormat patterns

提交回复
热议问题