-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonFormat.Feature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
not respected when deserialising Instant
s
#272
Comments
So does If latter, contributions for adding support would be most welcome: I think its missing is an omission; new per-property Features are added over time as requested. So it'd be good to get this use case covered. I do not think semantics of "WRITE_xxx" should be changed, but I do think there should be "READ_xxx" counterpart (and renaming of existing Enums is, unfortunately, major backwards-incompatibility so not doable for 2.x either) |
Thanks for the response! Yes, this was more about the inability to override I could try my hand at adding support, but unfortunately I'm not sure how much time I'd be able to give it. Am I right in thinking it would first need a change in the jackson-annotations repo, and then here? And would there be changes needed to handle non-java.time classes as well? |
Correct, a change would be needed in One thing is timing: if |
Ok, since it's just a small thing I went ahead and did FasterXML/jackson-annotations#221 -- so there is now |
Ok. So, good news is that The bad news is that plumbing may get bit hairy: looks like at least 4 deserializer implementations support nano-second format; ideally handling would be shared to some degree... |
Lol. Looking at |
At this point I do not have time to work on this unfortunately: I can help if someone has time & itch; all pieces are ready (ability to override reading with |
JFYI, working on pr. |
JsonFormat.Feature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
not respected when deserialising Instant
s
I have a class as follows:
When serialising, the result uses milliseconds since the epoch; however, when deserialising, it is interpreted as nanoseconds.
I understand that the JavaDoc says "Override for
SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
" (saying nothing aboutDeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS
), however in my view it's undesirable that a round-trip modifies the data when this option is used.Is there a way (other than writing my own deserialiser) to override the ObjectMapper's settings so that timestamps are interpreted using milliseconds?
The text was updated successfully, but these errors were encountered: