If I have:
case class Foo(a: String, b: Int)
and:
implicit val foo: RootJsonFormat[Foo] = jsonFormat2(Foo)
that works. However if I add:
case object Foo {
def apply(bar:Bar):Foo = Foo(bar.a, bar.b)
}
Then the compile on the marshalling line above fails:
Error:(18, 65) type mismatch;
found : io.xx.Foo.type
required: (?, ?) => io.xx.Foo
implicit val foo: RootJsonFormat[Foo] = jsonFormat2(Foo)
Any ideas how to fix this or what I’m doing wrong?