How to handle Parsing jsstring having null value


(Tenstriker) #1

I see recommendation is to use readNullable[String] in initialization of Reads but the type I have is Iterable[Array[String]]. Entire Iterable is not nullable but only the actual string value. Is there a way to apply to readNullable to String type only?

implicit val DataReads2 = (
(JsPath \ “results”).read[Iterable[Array[String]]] and // <-- here I want only String type to be nullable
(JsPath \ “exceptionMessage”).readNullable[String]
)(DataResponse.apply _)

I added some more detail here: