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
If you want to serialize Date
objects into ISO-8601, you don't need to specify a pattern at all - ISO-8601 is the default pattern. It is kind of mentioned in the JsonFormat Java doc:
Common uses include choosing between alternate representations -- for example, whether Date is to be serialized as number (Java timestamp) or String (such as ISO-8601 compatible time value) -- as well as configuring exact details with pattern() property.
[emphasasis mine] you should understand from the above text that specifying shape = STRING
would mean an ISO-8601 format but you can choose something else using the pattern
property.
In my experience, this always turns out a UTC date format (with the time zone rendered as +0000
), which could be the default time zone in my VM (even though my operating system clock is not set to UTC).