I have following case class
case class DataResponse(results: Iterable[Array[Option[String]]], exceptionMessage: Option[String])
I can't seem to be able to write Reads for this class mainly because of type of results
. If I try without option. i.e. Iterable[Array[String]]
it works but then it blows up when json string has null values.
implicit val DataReads2 = (
(JsPath \ “results”).read[Iterable[Array[Option[String]]]] and //compile error
(JsPath \ “exceptionMessage”).readNullable[String]
)(DataResponse.apply _)
compile error:
No Json deserializer found for type Iterable[Array[Option[String]]]. Try to implement an implicit Reads or Format for this type.
If I try to implement implicit Reads for that I get:
implicit val itrOptReads = Json.reads[Iterable[Array[Option[String]]]]
No apply function found for scala.collection.Iterable
basically, I can't seem to find a simpler way to handle unmarsheling json to Iterable[Array[Option[String]]]
. there should be one.