やりたいことを説明する方法がよくわからないので、例を作成します。
case class C1(id: String, name: String, description: String)
case class C2(id: String, status: Boolean)
trait Test[AnyRef] {
implicit val writesC1 = Json.writes[C1]
implicit val writesC2 = Json.writes[C2]
def test(obj:AnyRef) = {
println(Json.toJson(obj))
}
}
object OC1 extends Test[C1] {}
object OC2 extends Test[C2] {}
val x = C1(1, "test", "desc test")
C1.test(x) // Here I want my C1 instance to be parsed as Json