0

Hello I'm using jackson 2.8.8 with jackson-datatype-jsr310 extension. I notice that one time date time is serialized into:

"transactionDateTime" : "2017-06-13T16:21:40.123Z"

but another time into:

"transactionDateTime" : "2017-06-13T16:21:40.123+00:00"

First option shows most of times, but why sometimes Jackson is generating second one? My configuration:

    jackson2ObjectMapper.setVisibility(PropertyAccessor.ALL, Visibility.NONE);
    jackson2ObjectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);

    final JavaTimeModule javaTimeModule = new JavaTimeModule();
    jackson2ObjectMapper.registerModule(javaTimeModule);

    jackson2ObjectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
    jackson2ObjectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
pustypawel
  • 331
  • 2
  • 17
  • 2
    Does it always do the same values the same way, or is it entirely random? I doubt it is random, so maybe you can produce a [Minimal, Complete, and **Verifiable** example](https://stackoverflow.com/help/mcve)? – Andreas Jun 26 '17 at 16:47
  • How is your object field mapped/annotated? What values produces each output? –  Jun 26 '17 at 18:22
  • Always the same value, field object is not annotated simple private final ZonedDateTime transactionDateTime; – pustypawel Jun 26 '17 at 19:35
  • I'm always getting `Z` output. Could you [edit] the question and add the serialization code? –  Jun 26 '17 at 21:25
  • 1
    Both serialized strings are valid ISO 8601 strings. Are you asking because you are curious (I am!) or because you require one of them for some reason? – Ole V.V. Jun 27 '17 at 09:08
  • 1
    Your title says `+02:00` but your JSON example `+00:00`. Which are you getting? – Ole V.V. Jun 27 '17 at 09:10

0 Answers0