def parse()

in football/src/main/scala/com/gu/mobile/notifications/football/lib/NotificationsApiClient.scala [61:72]


  def parse(response: String): Option[UUID] = {
    def toUUID(idAttribute: JsValue): Option[UUID] = idAttribute match {
      case JsString(id) => Some(UUID.fromString(id))
      case _ => None
    }

    val parsed = Json.parse(response)
    parsed match {
      case JsObject(attributes) => attributes.get("id").flatMap(toUUID)
      case _ => None
    }
  }