Spring Boot LocalDate field serialization and deserialization

前端 未结 4 1377
孤独总比滥情好
孤独总比滥情好 2020-12-17 01:37

On spring boot 1.2.3.RELEASE with fasterxml what is the correct way of serializing and de-serializing a LocalDate field to iso date formatted string?

I\'ve tried:

4条回答
  •  独厮守ぢ
    2020-12-17 02:13

    If you want to use a custom Java Date formatter, add the @JsonFormat annotation.

    @JsonFormat(pattern = "dd/MM/yyyy")
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateSerializer.class)
    private LocalDate birthdate;*
    

提交回复
热议问题