LocalDate is serialized as an array

Viewed 1699

I'm using springBoot to develop a REST APi. And i have a LocalDate field "firstDate" in the response model of a GET endpoint. But this LocalDate is serializable as an array in the response's json!

"firstDate": [
        2021,
        3,
        1
      ],

So for consuming this APi, i have to define this date in my DTO as an array! which is not good! My reponse models of th API are generated with swagger so i can not use @JsonFormat(pattern="yyyy-MM-dd")

Can you help me please and tell me how to serialize LocalDate properly in this case ?

Thank you very much.

0 Answers
Related