For example, we have some case class
case class Foo(a: Int, b: List[String])
And we want to deserialize instance of Foo
from json {"a": 1}
replacing missing b
array with Nil
We can create custom decoder for such behavior
implicit val fooDecoder: Decoder[Foo] = (c: HCursor) =>
for {
a <- c.downField("a").as[Int]
b <- c.downField("b").as[Option[List[String]]
} yield Foo(a, b.getOrElse(Nil))
But, unfortunately, the created this way decoder doesn't accumulate all decoding failures.
Is there any way to create decoder with failures accumulation or any way to replace standard list deserialization behavior in circe?