I'm trying to follow the answer here https://stackoverflow.com/a/31641779/1586965
scalaVersion := "2.11.8"
val shapelessV = "2.3.3"
Firstly the following lines do not compile (it expects String
, but witness.value.name
is of type NameType
v <- m.get(witness.value.name)
So I tried changing to this
v <- m.get(witness.value.name.toString)
Then I try to get the example working, i.e.
case class Address(street: String, zip: Int)
case class Person(name: String, address: Address)
import FromMap._
import ConvertHelper.to
object Example {
val mp = Map(
"name" -> "Tom",
"address" -> Map("street" -> "Jefferson st", "zip" -> 10000)
)
to[Person].from(mp)
}
But I get
could not find implicit value for parameter fromMap: com.asos.datalake.staging.FromMap[R]
Aucun commentaire:
Enregistrer un commentaire