I understand this shouldn't happen, but a 3rd party API is returning JSON response, with the exact same field EITHER as Double/Float or as a String. After much internal debate of "why we live in a world like this", I'm struggling to find a way to parse such a response:
implicit val inconsistentReads: Reads[InconsistentItem] = (
(JsPath \ "field").readNullable[String] ...
)(InconsistentItem.apply _)
When this runs, I'm getting "play.api.libs.json.JsResultException: JsResultException" when the field sometimes is returned as a numeric value.
Would it be possible to read it in as String, regardless of if it was numeric or String in the Json response?
This is for Scala in Play Framework. Much thanks!