I tried to extract map data from json.
def getMap[K, V](js: JsValue, key: String): Map[K, V] = {
js \ key match {
case JsDefined(v) => v.as[Map[K, V]] // error here
case _: JsUndefined => throw new Exception("Error")
}
}
No Json deserializer found for type Map[K,V]. Try to implement an implicit Reads or Format for this type. not enough arguments for method as: (implicit fjs: play.api.libs.json.Reads[Map[K,V]])Map[K,V]. Unspecified value parameter fjs.
This function works when I define specific type for Map (ex: v.as[ Map[String, Int]], but not in generic. How should I do with it?