title: LocalDateTime is representing in array format
body: <p>I am using spring boot 2.2.6 and Jackson 2.10.3 with Java 8. I am using localdatetime objects through out my project. Jackson is not able to parse LocalDateTime properly (or may be it's default format) and sending date in json response as in array format like below</p>
  <pre><code>        &quot;createdDate&quot;: [
              2020,
              8,
              31,
              0,
              0,
              0,
              80000000
          ]
  </code></pre>
  <p>As described in <a href="https://stackoverflow.com/questions/29956175/json-java-8-localdatetime-format-in-spring-boot">JSON Java 8 LocalDateTime format in Spring Boot</a> , Spring boot 2 has already default jackson-datatype-jsr310:2.10.3 on classpath. I want dates to represent in json as 2020-03-31:00 in whole project. First solution doesn't work in the above link. After that  i have tried @JsonSerialize annotation and it works but i don't want to apply on each and every class. So also tried to override object mapper but it didn't work</p>
  <pre><code>@Primary
      @Bean
      public ObjectMapper objectMapper() {
          ObjectMapper mapper = new ObjectMapper();
          mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
          mapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, true);
          mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
          SimpleModule module = new SimpleModule(&quot;my custom date serializer&quot;);
          module.addSerializer(LocalDateTime.class,new LocalDateTimeSerializer());
          mapper.registerModule(module);
          return mapper;
      }
  </code></pre>
  <p>Also tried to customize Jackson2ObjectMapperBuilder, but still have date in array format</p>
  <pre><code>@Bean
      public Jackson2ObjectMapperBuilder objectMapperBuilder() {
          Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
          builder.serializationInclusion(JsonInclude.Include.NON_NULL);
          builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
          SimpleModule module = new SimpleModule(&quot;my custom date serializer&quot;);
          module.addSerializer(LocalDateTime.class,new LocalDateTimeSerializer());
          builder.modulesToInstall(modules)
          return builder;
      }
  </code></pre>
  <p><strong>Tried with also Jackson2ObjectMapperBuilderCustomizer</strong></p>
  <pre><code>@Configuration
  public class JacksonConfiguration {
  
      @Primary
      @Bean
      public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() {
          return builder -&gt; {
              builder.simpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss&quot;);
              builder.serializers(new LocalDateSerializer(DateTimeFormatter.ofPattern(&quot;yyyy-MM-dd&quot;)));
          };
      }
  }
  </code></pre>
  <p><strong>Contoller</strong></p>
  <pre><code>@RestConroller
  @RequestMapping(&quot;/user&quot;)
  UserController {
  
      User getUser(){
          User user = new User()
          user.createdDate = LocalDateTime.now();
          return user;
      }
  
  }
  </code></pre>
  <p>is there anything i can do at global level, so every date in the project will be serialized as in string format like 2020-09-01 ?</p>
  <p>Any suggestion will be helpful.</p>