我收到JSON解析错误:无法从String反序列化java.time.LocalDateTime
类型的值"2020-09-07T00:00.0+05:30异常
输入:
{
"sampleDate" : "2020-09-07T00:00:00.0+05:30"
}
SampleDto.java
public class SampleDto {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime sampleDate;
}
你能试试这个吗。看起来传递的日期格式不正确:
{
"sampleDate" : "2020-09-07T00:00:00.953Z"
}