Given the following from the argonaut docs:
import argonaut._
import Argonaut._
case class Person(name: String, age: Int)
implicit def PersonDecodeJson: DecodeJson[Person] =
jdecode2L(Person.apply)("name", "age")
scala> Json.obj("name" -> jString("bob"),
"age" -> jString("whoops - not a number.")
).as[Person]
res1: argonaut.DecodeResult[Person] = DecodeResult(Left((Int,CursorHistory(List(El(CursorOpDownField(age),true))))))
scala> Json.obj("name" -> jNumber(42),
"age" -> jString("whoops - not a number.")
).as[Person]
res2: argonaut.DecodeResult[Person] = DecodeResult(Left((String,CursorHistory(List(El(CursorOpDownField(name),true))))))
In res2, it appears that age's incorrect type, i.e. expected number, but got string, did not show up in the cursor output. In other words, it seems to me that the decoding failed fast on name.
Is there an "out of the box" DecodeJson that will return all failed decoding attempts?