报错如下
"JSON parse error: Cannot deserialize value of type
java.time.LocalDateTimefrom String \"2021-01-01 00:00:00\": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2021-01-01 00:00:00' could not be parsed at index 10; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type
java.time.LocalDateTimefrom String \"2021-01-01 00:00:00\": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2021-01-01 00:00:00' could not be parsed at index 10\n at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 6, column: 12] (through reference chain: com.example.validator.ValidatorEntity[\"birdth\"])",
解决方法:在日期字段上加 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
注解