scala - Fail to use Manifest to to extract data with json4s -
i have simple function takes string json , extract case class, looks this:
type extractiontype implicit def extractionmanifest: manifest[extractiontype] def myexctractionfunc: list[finalmodel] = { val mylist: list[finaltype] = parse(response.body).extract[extractiontype] ... }
now, theres 2 services (in different classes) using function , each 1 implementing extractiontype
, extractionmanifest
differently.
but, 1 service works perfect, , other im getting error:
the future returned exception of type: org.json4s.package$mappingexception, message: unknown error.
(myexctractionfunc
using futures , more complex stuff simplified it, why error mention future)
the implementation of service fail extract is:
case class person (name: string, age: int) override type extractiontype = list[person] override implicit val inmanifest = manifest.classtype[list[person]](classof[list[person]])
the service succeed looks this:
case class animal(kindofanimal: string, age: int) case class jungleobjects(animals: list[animal]) override type extractiontype = jungleobjects override implicit val inmanifest = manifest.classtype[jungleobjects](classof[jungleobjects])
does can see why 1 working , other not?
i had use case classes in projects separate things, simplified code question won't annoying :)
thanks!
Comments
Post a Comment