Unable to deserialize this using spray . I am unable to understand why the defaultJson protocol does not work. Please note I am new to scala and 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$1: spray.json.JsonReader[Boolean])Boolean. Unspecified value parameter evidence$1. Job(fields("param1").convertTo[Boolean]
I tried this first
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:
Of course I was not telling how to handle JobList