spray json 嵌套 class 无法反序列化

spray json nested class unable to deserialize

无法使用 spray 对此进行反序列化。我无法理解为什么 defaultJson 协议不起作用。请注意我是 scala 和 spray 的新手。

case class Job(param1:Boolean,param2:String,joblist:List[JobList])

case class 
JobList(param3:String,param4:Option[Seq[Map[String,String]]],....,param10)

implicit  object transformJson extends JsonFormat[Job]{

override def read(json: JsValue): Job = json match {
  case JsObject(fields) =>
    Job(fields("param1").convertTo[Boolean],
      fields("param2").convertTo[String],
      fields("jobslist").convertTo[List[JobList]]
    )

  case _ => deserializationError("Not a Record")
}

override def write(obj: Job): JsValue = ???

}

Error:(55, 39) Cannot find JsonReader or JsonFormat type class for Boolean Job(fields("param1").convertTo[Boolean], Error:(55, 39) not enough arguments for method convertTo: (implicit evidence: spray.json.JsonReader[Boolean])Boolean. Unspecified value parameter evidence. Job(fields("param1").convertTo[Boolean]

我先试了这个

object transformJson extends DefaultJsonProtocol{
     implicit val job=jsonFormat3(Job)
     implicit val joblist=jsonFormat7(JobList)

      }

Error:(53, 39) could not find implicit value for evidence parameter of type TransformJson.JF[Array[joblist]] implicit val jobformat=jsonFormat3(Job) Error:(53, 39) not enough arguments for method jsonFormat3:

当然我不是在告诉如何处理 JobList

case class Job(param1:Boolean,param2:String,joblist:List[JobList])

case class JobList(param3:String,param4:Option[Seq[Map[String,String]]],....,param10)
object TransformJobList extends DefaultJsonProtocol {
    implicit val joblist= jsonFormat7(JobList)
    implicit  object transformJson extends JsonFormat[Job]{

    override def read(json: JsValue): Job = json match {
        case JsObject(fields) =>
            Job(fields("param1").convertTo[Boolean],
                fields("param2").convertTo[String],
                fields("jobslist").convertTo[List[JobList]]
            )

        case _ => deserializationError("Not a Record")
    }

    override def write(obj: Job): JsValue = ???
    }
}