Jackson: parse custom offset date time

Viewed 31228

I have a model which has a timestamp property:

class Model {
    @JsonProperty("timestamp")
    private OffsetDateTime timestamp;
}

The format of the timestamp is as following:

2017-09-17 13:45:42.710576+02

OffsetDateTime is unable to parse this:

com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type java.time.OffsetDateTime from String "2017-09-17 13:45:42.710576+02": Text '2017-09-17 13:45:42.710576+02' could not be parsed at index 10

How can I fix this?

1 Answers
Related