ZonedDateTime can't be deserialized
See original GitHub issueI’m using spring boot 2.2.5 and I tried to deserialized ZonedDateTime provided by AWS SQS and got the same exception.
the date format I got from amazon as 2020-03-23T09:21:00.353Z
and the exception
Could not read JSON: Cannot construct instance of `java.time.ZonedDateTime` (no Creators, like default construct, exist): no String-argument constructor/factory method to deserialize from String value ('2020-03-23T09:21:00.353Z')
I explicitly make jackson as 2.9
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Jackson deserialization issue for ZonedDateTime
Jackson deserialize will by default to by pass the timezone infor and ... JsonMappingException: Can not instantiate value of type [simple ...
Read more >Option to have ZonedDateTime perform lenient deserialization
We are currently using the DataContractSerializer for serializing ZonedDatime data (among a lot of other things) to disk. We are in the process...
Read more >Value class NodaTime.ZonedDateTime cannot be ...
Coding example for the question NodaTime with MongoDB: Value class NodaTime.ZonedDateTime cannot be deserialized-mongodb.
Read more >Jackson Date - Baeldung
Deserialize Joda ZonedDateTime With Time Zone Preserved ... InvalidDefinitionException: Cannot construct instance of `java.time.
Read more >Simple Jackson Deserializer - pieterjd.be
As I was working on some random data with a ZonedDateTime, it turned out Jackson was unable to deserialize it. How come?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can narrow it more, I’m using the default ObjectMapper. I tried to customized and register
JavaTimeModule
but no difference. I can point that I’m usingspring-coud-aws
for this purpose to consume the message in SQS queue I’m not sure whether spring using a different way of deserializers for this module.regarding the version jackson I reverted to 2.10 and still the same issue
I raise to spring-cloud-aws team and let see their response.
Thanks
Ok, that helps narrow it, I suppose this issue can be closed? (Not sure what I was thinking on the array unwrapping, I see in the example that it is not an array.)
Though it would still be interesting to know why it doesn’t work out of the box for Spring Boot. Maybe a config issue with the way Spring is registering the Java time module? One possibility - are you using your own mapper or the default mapper?
https://codeboje.de/jackson-java-8-datetime-handling/
Now, a bit more about the registration - mabujaber mentioned explicitly using 2.9, and I see from the documentation the following: