how can I parse date to 'dd-MMM-yyyy' format using @JsonFormat from Jackson library? I am using Java 8 and Jackson 2.8.9.
Example: I would like to get: 2019-06-22T00:00:00Z -> 22-Jun-2019
I am using
@JsonFormat(pattern = "dd-MMM-yyy")
private Date myDate;
and I receive an exception:
JSON parse error: Can not deserialize value of type java.util.Date from String "2019-06-22T00:00:Z": expected format "dd-MMM-yyyy"
I thought I would be able to parse that date to expected format, but it looks like it is impossible in that way. Do you have any suggestions how can I do it? Im looking for the best approach. Can I do it using this annotation?