0
在我的應用我使用https://github.com/fommil/spray-json-shapeless庫serializaion,但我有問題,這個類:JsValue系列化失敗
case class FooResult(var id: Option[String], jobId: String, completedAt: DateTime, result: JsValue) extends JobResult
implicit val JobResultFormat: RootJsonFormat[JobResult] = {
import shapeless._
cachedImplicit
}
沒有類型的結果字段JsValue一切工作正常,但用它,我有以下情況除外:
[error] /home/mgosk/projects/spark-service/spark-rest-api/src/main/scala/com/xxx/http/services/SparkService.scala:134: ambiguous implicit values:
[error] both object JsValueFormat in trait AdditionalFormats of type com.xxx.spark.json.ServiceJsonProtocol.JsValueFormat.type
[error] and method familyFormat in trait LowPriorityFamilyFormats of type [T, Repr](implicit gen: shapeless.LabelledGeneric.Aux[T,Repr], implicit sg: shapeless.Cached[shapeless.Strict[com.xxx.spark.json.ServiceJsonProtocol.WrappedRootJsonFormat[T,Repr]]], implicit tpe: shapeless.Typeable[T])spray.json.RootJsonFormat[T]
[error] match expected type spray.json.JsonFormat[spray.json.JsValue]
任何建議如何處理它。