【发布时间】:2015-04-04 11:20:13
【问题描述】:
在我的 Scala Spray.io 应用程序中,我想将一些 Joda LocalTime 和 LocalDate 对象转换为 JSON。这显然是通过将 Json4s 的 JodaTime 支持添加到 DefaultFormats 来完成的,如下所示:
object Json4sProtocol extends Json4sSupport {
implicit def json4sFormats: Formats = org.json4s.DefaultFormats ++ org.json4s.ext.JodaTimeSerializers.all
}
但由于某种原因,我无法访问extpackage:object ext is not a member of package org.json4s。任何想法为什么会发生这种情况?
我很清楚加载依赖项的方式可能存在一些问题。我将此行添加到我的build.sbt:
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-jackson" % "3.2.11",
...
)
【问题讨论】: