I have the following failing test case:
case class ActionRequest(action: String, `type`:String, key: String)
"Actions " should " be decoded correctly" in {
val actionJson =
"""[
|{"Action":"view","Type":"Product","Key":"1210"},
|{"action":"filter","type":"by-price","key":"low-hi"}
|]
|""".stripMargin
val actions = decode[List[ActionRequest]](actionJson).right.getOrElse(List())
assert(actions.size == 2)
}
decoding fails with error:
LeftProjection(Left(DecodingFailure([A]List[A], List(DownField(action), DownArray))))
Is it possible for the decoder to map fields ignoring the case sensitivity? Or maybe there is an elegant way handle this with decoder.prepare?
Thanks!