我implicit val reads
用来映射 Json 像:
{
"id": 1
"friends": [
{
"id": 1,
"since": ...
},
{
"id": 2,
"since": ...
},
{
"id": 3,
"since": ...
}
]
}
到一个案例类
case class Response(id: Long, friend_ids: Seq[Long])
我只能让它与反映 JSONfriends
结构的中间类一起工作。但我从不在我的应用程序中使用它。有没有办法编写一个Reads[Response]
对象,以便我的 Response 类直接映射到给定的 JSON?