Does xdotai/play-json-extensions support Seq in a case class?

(Larry Simon) #1

Does Jsonx.toJson(z: X) work i.e. would X(Seq(Y(1),Y(2),Y(3))) produce {“a”: [ {“b”: 1}, {“b”: 2}, {“b”: 3} ] }? I’m getting “No Json formatter found for type Seq[Y]”.

case class X(a: Seq[Y])

object X {
implicit lazy val jsonFormat = Jsonx.formatCaseClass[X]

case class Y(b: Int])

object Y {
implicit lazy val jsonFormat = Jsonx.formatCaseClass[Y]

(Larry Simon) #2

Solution: Reverse the order of the case classes in the file.