1
私はスプレーjsonで循環参照される構造体JSONを定義したいので、私は以下のように定義しようとします。spray-jsonを使用して循環参照JSON定義を定義する方法は?
final case class A(b: B)
final case class B(a: A)
trait AProtocol extends DefaultJsonProtocol {
implicit val aProtocol: RootJsonFormat[A] = rootFormat(lazyFormat(jsonFormat1(A)))
}
しかし、私は私にいくつかのアドバイスを与えてください
<console>:18: error: could not find implicit value for evidence parameter of type MyProtocol.this.JF[B]
implicit val aProtocol: RootJsonFormat[A] = rootFormat(lazyFormat(jsonFormat1(A)))
でエラーが発生しました。
私はあなたが言ったように試み、それはうまく動作します。あなたのアドバイスをありがとう。 – mtwtkman