0

I am having trouble with serialization. My pojo has the following property.

@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
Date startTime;

I use the same object to send out response and process response. In other words this same project is used to serialize and deserialize.

I am getting the following error however. I line-break the error for readability

JSON decoding error: 
Cannot deserialize value of type `java.util.Date` from String "2021-06-11T19:25:02.850Z": 
expected format "yyyy-MM-dd  HH:mm:ss.SSS"; 
nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: 
Cannot deserialize value of type `java.util.Date` from String "2021-06-11T19:25:02.850Z": 
expected format "yyyy-MM-dd  HH:mm:ss.SSS"

I have no idea why "yyyy-MM-dd HH:mm:ss.SSS" is expected while the annotation is "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"

0 Answers0