Skip to content

ZonedDateTime serialize with @JsonFormat pattern never uses it, and then while deserialization can't parse it #3057

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

Closed
verve111 opened this issue Nov 25, 2024 · 2 comments
Labels
for: external-project For an external project and not something we can fix

Comments

@verve111
Copy link

Hi, I'm using JavaTimeModule() in spring-data-redis implementation of my app and there's a strange thing:
When JsonFormat-annotation with pattern is added:

data class CacheValue(
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
    val zonedDateTime: ZonedDateTime
)

Current object is always stored in Redis as an ISO_ZONED_DATE_TIME, e.g. "2024-11-15T18:27:06.921054+01:00[Europe/Germany]", the pattern is not taken into an account.
But then when deserialization comes, it tries to deserialize the ISO_ZONED_DATE_TIME formatted object from Redis with "yyyy-MM-dd'T'HH:mm:ss.SSSZ" pattern and fails.
Could you please give a hint, what is wrong here. I guess jackson serializer supposed to use pattern to encode the date, thank you!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 25, 2024
@mp911de
Copy link
Member

mp911de commented Nov 27, 2024

Which Jackson serializer do you use? It would be the easiest if you could provide a reproducer, it can be as simple as a self-contained JUnit test file that contains your entire setup of the serializer, the reproducer code and your data model.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Nov 27, 2024
@verve111
Copy link
Author

verve111 commented Dec 4, 2024

Sorry, it seems the issue completely relates to fasterxml jackson lib, I'm moving the question there: FasterXML/jackson-modules-java8#333
Regards

@verve111 verve111 closed this as completed Dec 4, 2024
@mp911de mp911de added for: external-project For an external project and not something we can fix and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

3 participants