- 
                Notifications
    You must be signed in to change notification settings 
- Fork 124
Closed
Labels
json-formatMissing handling of `@JsonFormat` property annotationMissing handling of `@JsonFormat` property annotation
Description
Lines 84 to 88 in 3075bfe
| @Override | |
| protected DurationSerializer withFormat(DateTimeFormatter dtf, | |
| Boolean useTimestamp, JsonFormat.Shape shape) { | |
| return new DurationSerializer(this, dtf, useTimestamp); | |
| } | 
If I do this, I expect an integer number in JSON representing the number minutes:
@JsonFormat(pattern = "MINUTES")
@JsonProperty("durationInMins")
Duration duration;But it serializes it as nanoseconds. After some debugging, I decided to add , shape = NUMBER_INT in order to force com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase#useNanoseconds respond false, but it has no effect because shape is not used in the factory method I linked above.
Found a workaround: adding , without = JsonFormat.Feature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS to @JsonFormat. However, it only works if I add it to each property, adding it on class level has no effect.
Metadata
Metadata
Assignees
Labels
json-formatMissing handling of `@JsonFormat` property annotationMissing handling of `@JsonFormat` property annotation