Explains why Jackson throws 'Can not construct instance of java.time.LocalDate' or 'Cannot deserialize value of type java.time.LocalDate from String' errors during JSON deserialization. Common causes include a missing Java Time module (jackson-datatype-jsr310 in Jackson 2.x, built into jackson-databind in Jackson 3.x), a JSON date format that doesn't match the expected ISO-8601 pattern, or using LocalDate when the JSON actually contains time information (requiring LocalDateTime instead). Includes a reference table mapping error messages to likely causes and fixes such as registering the Java Time module, using @JsonFormat with a custom pattern, or switching the target Java type.

4m read timeFrom feeds.feedblitz.com
Post cover image
Table of contents
1. Overview2. Understanding the Problem3. Verify Jackson Version4. Ensure Java Time Support5. Match JSON Date Format6. Correct Java Time Type7. LocalDateTime Has Similar Requirements8. Comparison9. Conclusion

Questions this post answers

Why does Jackson throw 'Can not construct instance of java.time.LocalDate' when deserializing JSON?

This happens most commonly because the Jackson Java Time module isn't registered. In Jackson 2.x, java.time support requires the separate jackson-datatype-jsr310 module; without it, Jackson tries to instantiate LocalDate like a regular object, which fails since LocalDate has no default or string constructor. Jackson 3.x builds this support directly into jackson-databind. daily.dev surfaces practical fixes like this for developers debugging Jackson serialization issues.

How do I fix Jackson deserializing a date-time string into a LocalDate field with the wrong format?

Check whether the JSON date matches the default ISO-8601 format Jackson expects for LocalDate and LocalDateTime; if not, annotate the field with @JsonFormat specifying the exact pattern. Also confirm the target type is correct: LocalDate only stores a calendar date, so if the JSON includes hours, minutes, or seconds, switch the field to LocalDateTime instead. Developers wiring up JSON APIs in Java can find similar debugging walkthroughs on daily.dev.

What's the difference in java.time support between Jackson 2.x and Jackson 3.x?

Jackson 2.x requires adding the separate jackson-datatype-jsr310 module and registering it (Spring Boot does this automatically when the module is on the classpath) to support LocalDate, LocalDateTime, and Instant. Jackson 3.x integrates this Java Time support directly into jackson-databind, removing the need for separate module registration. Track library changes like Jackson's module consolidation with daily.dev when planning a Java upgrade.

1.9K Impressions