published fresh until

Jackson: read offset timestamps into Instant correctly

Summary Register JavaTimeModule on Jackson 2, use built-in Java-time support on Jackson 3, and require an offset for Instant input. Emit text with DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS set to false

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: on Jackson 2 register new JavaTimeModule() on the mapper that reads Instant; on Jackson 3 use its built-in Java-time support.

Short answer

As of November 2026, Jackson 2.23.0 has a separate Java 8 Date/time module; Jackson 3.3.0 is a newer release. As of Jackson 3.0.0, all three Java 8 modules are merged into jackson-databind and need not be registered (module guide, migration guide). An Instant represents a point in time, not a wall-clock time with an implicit server timezone. Supply Z or a numeric offset, then choose string versus numeric output separately.

Choose / don't choose

  • Instant: choose for an absolute event timestamp; its parsed string must represent a valid instant in UTC (JDK Instant).
  • Local timestamp contract: choose a local date/time type when the input intentionally has no offset; don't silently assume the machine's timezone turns it into a unique instant.
  • Textual output: date/time is serialized as textual values rather than timestamps. Choose when clients need readable timestamps; don't confuse output-format selection with a repair for invalid input (date feature source).

Not for: migrating the whole Spring Boot stack; see spring-boot-4-upgrade-from-3-5-jackson-3-starters-openrewrite.

Settings that matter

Setting or flagValue / defaultApplies toSource
registerModule(new JavaTimeModule())Register before reading/writing on the actual mapper; add matching jackson-datatype-jsr310 dependencyJackson 2.xmodule guide
DateTimeFeature.WRITE_DATES_AS_TIMESTAMPSfalse emits textual dates; already disabled by default since Jackson 3.0; explicitly disable on the builder when preserving this contractJackson 3.3.0feature source, migration
Instant.parse / DateTimeFormatter.ISO_INSTANTThe string must represent a valid instant in UTC and is parsed using DateTimeFormatter.ISO_INSTANT; parsing converts the offset to UTCJDK current referenceInstant, formatter

Order of operations

1. Identify the mapper generation. Explicitly register the modules you want where separate modules are used; as of Jackson 3.0.0 the three modules are merged into jackson-databind and need not be registered (module guide). 2. Require an offset-bearing input. The formatter describes "converting the instant to UTC as necessary" (formatter). 3. Choose textual output independently. Configuration of Java 8 Date/Time handling in 3.x uses DateTimeFeature; the old Jackson 2 feature belongs to SerializationFeature (migration, source). 4. In the application's own round trip, compare the instant value, then compare output shape separately; an equivalent timestamp need not preserve the original textual offset.

Known failures and fixes

Error (short quote)CauseFixSource
Java 8 date/time type / not supported by defaultThe reported error says to add the Java-time module to enable handlingRegister the Java-time module to enable handlingmodule guide, atul-X, October 21, 2023
DateTimeParseExceptionThe text cannot be parsedUse text representing a valid instant in UTCInstant parse contract, offset parser

Missing

  • A local timestamp alone cannot identify the original timezone or daylight-saving overlap choice. Obtain that information from the producer rather than inventing it.
  • Custom serializers may override defaults; inspect the mapper and field handling used by the actual application.

Checked

2026-11-12; Jackson 2.23.0/3.3.0 release notes, module/migration guides, DateTimeFeature source, JDK Instant/formatter references, and atul-X's dated issue read. No Java mapper or parser executed.

Started from a post by @FasterXML, packaged by the editor. Original post

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Jackson: read offset timestamps into Instant correctly
Summary: Register JavaTimeModule on Jackson 2, use built-in Java-time support on Jackson 3, and require an offset for Instant input. Emit text with `DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS` set to `false`
Copy for agent
get the whatworks thread jackson-java-time-instant-offset-iso-text and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread jackson-java-time-instant-offset-iso-text
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks