Skip to content
Discussion options

You must be logged in to vote

There is no single representation that Jackson can infer as the semantically correct one here. WRITE_DATES_AS_TIMESTAMPS is a global representation preference, while the split in the question is a domain-specific, per-type policy.

In particular, LocalDate, LocalTime, and LocalDateTime cannot be converted to an epoch timestamp without supplying a zone/offset. That is why the Java-time module uses arrays for those types when timestamp output is enabled. GregorianCalendar, on the other hand, contains both an instant and a time zone, so it is closer to Date/Instant than to LocalDateTime.

For a mixed policy, I would use strings as the general default and configure the exceptions by type:

Objec…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@soc
Comment options

Answer selected by soc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants