'Parsing Date/Time format with Jackson [duplicate]

I'm receiving the date/time from a request which will be in the following format: Thu, 03 Feb 2022 22:07:25 +0000. I want to have Jackson read this as either a LocalDateTime or ZonedDateTime.

I have tried using the @JsonFormat annotation like so:

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "ddd, dd mmm yyyy HH:mm:ss Z")
ZonedDateTime timestamp;

But I am getting an error: Cannot construct instance of java.time.ZonedDateTime (no Creators, like default constructor, exist): no String-argument constructor/factory method to deserialize from String value ('Thu, 03 Feb 2022 22:07:25 +0000')

Any ideas?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source