question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow `LocalDate` to be serialized/deserialized as number (epoch day)

See original GitHub issue

The LocalDateSerializer only supports serializing LocalDate instances as strings or arrays, both of which suffer from localization issues (“is it year-month-day or year-day-month?”).

An alternative would be to use LocalDate#toEpochDay() and LocalDate#ofEpochDay(long), thus allowing a (less human readable but) unambiguous format.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cowtowncodercommented, Mar 15, 2017

If there is indeed variant to convert to/from long, supporting @JsonFormat(shape=Shape.NUMBER) would make sense I think? Support should also require deserializer handling.

0reactions
cowtowncodercommented, Mar 27, 2017

As per notes on PR, will merge as soon as we get CLA; will make it in 2.9(.0.pr3)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jackson: deserialize epoch to LocalDate - java - Stack Overflow
How can I deserialize epoch to LocalDate ? I would like to add that if I change the datatype from LocalDate to java.util.Date...
Read more >
Serializing LocalDate to JSON in Spring Boot - Reflectoring
Today, I stumbled (once again) over LocalDate in a Spring Boot application. LocalDate came with Java 8 and is part of the new...
Read more >
Serialize Date by using Jackson - Javatpoint
In order to serialize the "java.util.Date", we take the help of the Event class. We first create a date by using SimpleDateFormat class....
Read more >
Jackson Date - Baeldung
It's important to note that Jackson will serialize the Date to a timestamp format by default (number of milliseconds since January 1st, ...
Read more >
LocalDate (Java SE 10 & JDK 10 ) - Oracle Help Center
LocalDate is an immutable date-time object that represents a date, often viewed as year-month-day. Other date fields, such as day-of-year, day-of-week and week- ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found