I have the following declaration in my object:
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX")
private ZonedDateTime start;
And when I parse timestamps like 2016-12-08T12:16:07.124Z (using Jackson Json De-serilaizer) it works fine, but once I receive timestamps without milliseconds (such as "2016-12-08T12:16:07Z"), it throws exception.
How I can possibly make milliseconds optional in format specification?
If you are using Java 8 Try specifying
.SSS
inside square brackets[.SSS]