JSON parse error: raw timestamp (1682265600000) not allowed for java.time.LocalDateTime:…
- User
JSON parse error: raw timestamp (1682265600000) not allowed for
java.time.LocalDateTime: need additional information such as an offset or time-zone (see class Javadocs); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: raw timestamp (1682265600000) not allowed forjava.time.LocalDateTime: need additional information such as an offset or time-zone (see class Javadocs) at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 14] (through reference chain: com.jack.ihs.basic.query.StyleQuery["startTime"]) - Assistant
This error occurs when attempting to parse a JSON string that includes a raw timestamp for a
java.time.LocalDateTimeobject, but without additional information such as an offset or time-zone. TheLocalDateTimeclass does not contain time-zone information, so it requires additional context to properly parse the timestamp.To fix this error, you can either provide additional context such as a time-zone or offset when creating or parsing the
LocalDateTimeobject, or you can use a different data type that includes time-zone information such asjava.time.ZonedDateTimeorjava.util.Date. - User
翻译成中文
- Assistant
当尝试解析包含原始时间戳的JSON字符串用于
java.time.LocalDateTime对象时,如果没有提供附加信息,如偏移量或时区,则会发生此错误。LocalDateTime类不包含时区信息,因此它需要附加上下文来正确解析时间戳。要解决此错误,您可以在创建或解析
LocalDateTime对象时提供附加上下文,如时区或偏移量,或者您可以使用包含时区信息的不同数据类型,如java.time.ZonedDateTime或java.util.Date。