【发布时间】:2018-05-02 21:44:01
【问题描述】:
我有一个使用 Java JodaTime 的现有应用程序。但是,在升级到最新的 json4s-core 库 3.6.0-M3 后,将带有时区的日期字符串转换为日期时出现以下错误。
Caused by: java.lang.IllegalArgumentException: No instant converter found for type: org.json4s.ext.DateParser$ZonedInstant
当我编写自定义DateTime 序列化程序时会发生这种情况,该序列化程序具有多种格式的回退:
case JString(s) ⇒ Try(dateTimeFormat.parseDateTime(s)).getOrElse(new DateTime(DateParser.parse(s, format)))
导致问题的示例字符串:2018-05-02T21:43:29Z
我确定我使用的是 jodatime 2.9.2 和匹配的 json4s-ext 库
【问题讨论】: