找不到隐式 json 格式的证据参数的隐式值
could not find implicit value for evidence parameter for implicit json formats
我正在尝试为我的案例简单地创建一个 json 格式 类:
case class ImageRequest (inputs: Array[ImageObject])
case class ImageObject(data: Data)
case class Data(image: Image)
case class Image(url: String)
这里是隐式格式:
object ApplicationProtocol extends DefaultJsonProtocol {
lazy implicit val ImageRequestFormat = jsonFormat(ImageRequest, "inputs")
lazy implicit val ImageObjectFormat = jsonFormat(ImageObject, "data")
lazy implicit val DataFormat = jsonFormat(Data, "image")
lazy implicit val ImageFormat = jsonFormat(Image, "url")
}
我收到错误:
> could not find implicit value for evidence parameter of type
> connectors.ClarifaiConnector.ApplicationProtocol.JF[Array[model.ImageObject]]
> [error] lazy implicit val ImageRequestFormat =
> jsonFormat(ImageRequest, "inputs") [error]
> ^ [error]
> /Users/MacZ/Dropbox/Work/Development/JobOffer/ImageProject/src/main/scala/connectors/clarifaiConnector.scala:27:53:
> could not find implicit value for evidence parameter of type
> connectors.ClarifaiConnector.ApplicationProtocol.JF[model.Data]
> [error] lazy implicit val ImageObjectFormat =
> jsonFormat(ImageObject, "data") [error]
> ^ [error]
> /Users/MacZ/Dropbox/Work/Development/JobOffer/ImageProject/src/main/scala/connectors/clarifaiConnector.scala:28:46:
> could not find implicit value for evidence parameter of type
> connectors.ClarifaiConnector.ApplicationProtocol.JF[model.Image]
> [error] lazy implicit val DataFormat = jsonFormat(Data, "image")
> [error] ^
一切都已导入并且似乎在范围内
更改隐式的顺序:
object ApplicationProtocol extends DefaultJsonProtocol {
implicit val ImageFormat = jsonFormat(Image, "url")
implicit val DataFormat = jsonFormat(Data, "image")
implicit val ImageObjectFormat = jsonFormat(ImageObject, "data")
implicit val ImageRequestFormat = jsonFormat(ImageRequest, "inputs")
}
我正在尝试为我的案例简单地创建一个 json 格式 类:
case class ImageRequest (inputs: Array[ImageObject])
case class ImageObject(data: Data)
case class Data(image: Image)
case class Image(url: String)
这里是隐式格式:
object ApplicationProtocol extends DefaultJsonProtocol {
lazy implicit val ImageRequestFormat = jsonFormat(ImageRequest, "inputs")
lazy implicit val ImageObjectFormat = jsonFormat(ImageObject, "data")
lazy implicit val DataFormat = jsonFormat(Data, "image")
lazy implicit val ImageFormat = jsonFormat(Image, "url")
}
我收到错误:
> could not find implicit value for evidence parameter of type
> connectors.ClarifaiConnector.ApplicationProtocol.JF[Array[model.ImageObject]]
> [error] lazy implicit val ImageRequestFormat =
> jsonFormat(ImageRequest, "inputs") [error]
> ^ [error]
> /Users/MacZ/Dropbox/Work/Development/JobOffer/ImageProject/src/main/scala/connectors/clarifaiConnector.scala:27:53:
> could not find implicit value for evidence parameter of type
> connectors.ClarifaiConnector.ApplicationProtocol.JF[model.Data]
> [error] lazy implicit val ImageObjectFormat =
> jsonFormat(ImageObject, "data") [error]
> ^ [error]
> /Users/MacZ/Dropbox/Work/Development/JobOffer/ImageProject/src/main/scala/connectors/clarifaiConnector.scala:28:46:
> could not find implicit value for evidence parameter of type
> connectors.ClarifaiConnector.ApplicationProtocol.JF[model.Image]
> [error] lazy implicit val DataFormat = jsonFormat(Data, "image")
> [error] ^
一切都已导入并且似乎在范围内
更改隐式的顺序:
object ApplicationProtocol extends DefaultJsonProtocol {
implicit val ImageFormat = jsonFormat(Image, "url")
implicit val DataFormat = jsonFormat(Data, "image")
implicit val ImageObjectFormat = jsonFormat(ImageObject, "data")
implicit val ImageRequestFormat = jsonFormat(ImageRequest, "inputs")
}