我有一个具有即时类型的 JSON 对象,其值2019-10-17T15:10:33.639Z但是当我解析它时,我遇到了这个错误:org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected token (START_OBJECT), expected one of [VALUE_STRING, VALUE_NUMBER_INT, VALUE_NUMBER_FLOAT] for java.time.Instant value; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected token (START_OBJECT), expected one of [VALUE_STRING, VALUE_NUMBER_INT, VALUE_NUMBER_FLOAT] for java.time.Instant value
at [Source: (PushbackInputStream); line: 1, column: 28] (through reference chain: com.bendiciones.buenas.noches.Bendiciones["estimatedResolutionDate"])
1 回答
慕盖茨4494581
TA贡献1850条经验 获得超11个赞
在您的 Instant 属性上添加@JsonFormat,执行如下操作
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ") private Instant currentdDate;
添加回答
举报
0/150
提交
取消