Reading through this article, I can't figure out how to convert my Some(JsValue) to a String.
Example:
val maybeString: Option[JsValue] = getSomeJsValue(); // returns Some(JsValue)
val str: String = maybeString match {
case Some(x) => x.as[String]
case _ => "0"
}
run-time error:
play.api.Application$$anon$1: Execution exception[[JsResultException: JsResultException(errors:List((,List(ValidationErr
or(validate.error.expected.jsstring,WrappedArray())))))]]
at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.3]