0
私はJsonとしてレンダリングしたい2つの異なるオブジェクトを持っています。私は彼らの暗黙の書き込みを書いており、それらを連結応答で戻したいと思っています。私は関係なく、私は何をすべきかScala Playで異なるJson値を1つのレスポンスに連結
をエラーCompilation error[No Json serializer found for type Seq[models.RedisInfo]. Try to implement an implicit Writes or Format for this type
を受けていない保つ
は、ここに私のコードは
def listAll() = Action.async { implicit request =>
import models.Psql.{sqlUploadWrites => sqlWrites}
import models.Redis.{redisWrites}
val rFut:Future[Seq[RedisInfo]] = Redis.listAll()
val sqlFut:Future[Seq[SQLInfo]] = SQL.listAll()
val resp = Future.sequence(Seq(rFut, sqlFut)).map{
/* Now I want to use their individual write methods to create the Json
and then wrap the result of the two into a Future[Result]
case x: Seq[RedisInfo] => x.map(res => Json.toJson(res)(redisWrites))
case y: Seq[SQLInfo] => y.map(res => Json.toJson(res)(sqlWrites))
}
シーケンスが同じ長さではありませんどのようになるのです。これは個別に行うとうまくいくようにも見えます。このため、余分な複雑さが何であるか不思議です。
を実行する必要がwhereever
その後、あなたが期待されるJSONのスキーマを定義する必要がありuuidFormatをインポート – cchantep