jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Systemwide property to disable the "Java 8 date/time XYZ not supported by default" error

Open stickfigure opened this issue 1 year ago • 7 comments

Is your feature request related to a problem? Please describe.

Jackson 2.12 introduced the "always break when trying to serialize java.time objects without the JavaTimeModule` behavior.

Unfortunately, this breaks our 1M+ line codebase which makes ObjectMappers all over the place. And we have client applications that expect the (terrible) POJO format for some time objects.

It looks like you've already thought about this with your comment here:

https://github.com/FasterXML/jackson-databind/blob/e230f61b05f69cba74f933bd74479b7d764fa9d5/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java#L885

We've pinned jackson to 2.11.4 across the board but this is not a sustainable solution.

Describe the solution you'd like

Ideally, a system property that restores the old behavior - let java.time.* be serialized as objects. A distant second would be a feature to enable on the objectmapper which restores old behavior. That would require hunting down every possible objectmapper creation in our codebase, which will hurt.

Usage example

No response

Additional context

No response

stickfigure avatar May 17 '24 14:05 stickfigure