【发布时间】:2013-11-01 10:46:21
【问题描述】:
我正在尝试执行以下操作(我使用 spray-json_2.9.2 v1.2.3,因为我使用的是 scala 2.9.2)
import spray.json._
import spray.json.DefaultJsonProtocol
import DefaultJsonProtocol._
case class TestMe(key: String, value: String)
object MyJsonProtocol extends DefaultJsonProtocol {
implicit val prot = jsonFormat4(TestMe)
}
但我得到编译错误:
TestMe.type(带有底层类型对象 com...TestMe) [INFO] 必需:(?, ?, ?, ?) => ? [INFO] 注意:隐式值 prot 在这里不适用,因为它 出现在应用程序点之后,并且缺少明确的结果类型 [INFO] 隐式 val prot = jsonFormat4(TestMe)
我做错了什么我刚刚关注了文档:https://github.com/spray/spray-json#providing-jsonformats-for-case-classes
谢谢
【问题讨论】: