0

What is the best of of serialising an array of LocalDate objects?

This is what I have:

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy")
@JsonDeserialize(using = LocalDateDeserializer.class)
private LocalDate[] dates;

With my own custom deserializer which expects a single date. It throws this error:

2018-06-18T12:14:11.030+0100 WARN [http-nio-8080-exec-5] org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver:384: Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Current token (VALUE_STRING) not numeric, can not use numeric value accessors

Is there a quick way of getting this deserializer to work with an array?

4

0 回答 0