-
Notifications
You must be signed in to change notification settings - Fork 116
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
Disabling WRITE_DATES_AS_TIMESTAMPS not working? #11
Comments
That's most likely a problem coming from spring configuration.
|
Thanks. |
Assuming this gets resolved as described, as Spring config is out of Jackson's hands. |
Where do you put this in your code? ObjectMapper mapper = new ObjectMapper() Thanks! |
Nowhere, you aren't supposed to instantiate your |
Hey guys, sorry for reopening this issue. I've tried all of the solutions above to solve this problem but my Spring Controller keeps serializing I think it could be a version conflict since I'm using other dependencies, but I don't know how to check for this. Can anyone shine a light on how can I do it? |
Make sure you have this in your application.yml: spring: Keep the 3 noted in project title page in dependencies: |
If you are using swagger with spring boot and your date is Date is always getting serialised as long,
and SerializationFeature.WRITE_DATES_AS_TIMESTAMPS & spring.jackson.serialization.write-dates-as-timestamps=false
Actual issue: SerializationFeature.WRITE_DATES_AS_TIMESTAMPS value is not read from spring configuration file which need to be set false in order to covert long value while serialisation. |
Should there be, or is there, an issue filed with Spring for this? |
@cogito-abhijeet
Is this issue reported to Spring? |
According to the /datetime/ summary, java.time.offsetDateTime objects should serialize out to ISO-8601 strings simply by disabling the SerializationFeature#WRITE_DATES_AS_TIMESTAMPS feature?
I've tried to do this in two different ways in the JacksonConfig class:
In both cases, serialized offsetDateTime objects continue to be printed in nanosecond timestamp format (i.e. "expiresOn":1486138656.853000000).
Only by actually declaring @jsonformat can I get them to print out in ISO-8601 string.
Is anyone else having this issue?
The text was updated successfully, but these errors were encountered: