I am trying to parse json object with a list inside let's say
{
"foo": 12,
"bar": [ 12, null, null, 32 ]
}
In our project we are referring to the scala play documentation and trying to declare a simple json read parser like Json.reads[MyObject]
and case class looks like:
case class MyObject(
foo: Int,
bar: List[Option[Int]]
)
but compiler complains about it:
Error:(93, 42) No instance of play.api.libs.json.Reads is available for scala.collection.immutable.List[scala.Option[scala.Int]] in the implicit scope (Hint: if declared in the same file, make sure it's declared before)
implicit val readMyObject = Json.reads[MyObject]
Anyone knows any workarounds?
https://www.playframework.com/documentation/2.6.x/ScalaJsonCombinators