Replies: 4 comments 3 replies
-
Ideally we would get to something better than tons of one-off But as to |
Beta Was this translation helpful? Give feedback.
-
In my view, everything that can be done with the With that said, it looks like So, it looks like (https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-5) will be the way to go instead of one off type features. Maybe I can help with it. Do you have any specific direction that you would like to go with |
Beta Was this translation helpful? Give feedback.
-
Thought I'ld chime in since I had originally proposed in late 2022 on the jackson-dev google group that Jackson 3 should by default serialize date/times using RFC 3339 profile of the ISO 8601 format here https://groups.google.com/g/jackson-dev/c/BfLjoaCF7fQ/m/x4BYSxTuCAAJ - Seemed to have had broad consensus, and I don't think that has changed for many. Summarising reasons,
Completely agree with this sentiment - more binary feature toggles are going to be more confusing. Example ObjectMapper mapper = JsonMapper.builder().findAndAddModules().build();
OffsetDateTime odt1 = OffsetDateTime.parse("2020-01-01T00:00:00+10:00");
String json = mapper.writeValueAsString(odt1); // "2020-01-01T00:00:00+10:00"
OffsetDateTime odt2 = mapper.readValue(json, OffsetDateTime.class);
System.out.println(odt2); // 2019-12-31T14:00Z 😮 I can't speak for everyone, but personally, I would be in favour of taking an opinionated configuration approach, possibly promoting core Should users wish to customise the formatting and deviate from industry norms, they could register their own module to support complex and unusual formats (or possibly JavaTimeModule if feasible), apply custom deserializers, or pre/post-convert manually in the application layer shifting the responsibility onto the user. |
Beta Was this translation helpful? Give feedback.
-
@tmoschou Thank you for writing up this -- I will need to read it with thought after I come back for my vacation (leaving today, back in 2 weeks). But with quick glance I think I agree with most of what you suggest. In addition, I think that wrt default setting changes for 3.0 (https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-2), an obvious change (along your suggestion) would be one proposed but not yet done:
How exactly it'd play with other settings would be open to discussion: one challenge being to ensure proper layering of settings (global |
Beta Was this translation helpful? Give feedback.
-
Should there be a
SerializationFeature.WRITE_INSTANTS_AS_TIMESTAMPS
similar toSerializationFeature.WRITE_DATES_AS_TIMESTAMPS
?Also, should there be support for
@JsonFormat(shape - JsonFormat,Shape.NUMBER)
on Instant fields?Let me know your thoughts. I would be glad to work on such a feature
Beta Was this translation helpful? Give feedback.
All reactions