object JsResult
- Source
- JsResult.scala
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- JsResult
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Type Members
- case class Exception(cause: JsError) extends java.lang.Exception with NoStackTrace with Product with Serializable
Value Members
- implicit def alternativeJsResult(implicit a: [JsResult]): [JsResult]
- implicit val applicativeJsResult: [JsResult]
- def fromTry[T](result: Try[T], err: (Throwable) => JsError = e =>
JsError(e.getMessage)): JsResult[T]
Returns a scala.util.Try as JSON validation.
Returns a scala.util.Try as JSON validation.
- T
the type for the parsing
- result
the result
- err
the function to be applied for scala.util.Failure
- implicit val functorJsResult: [JsResult]
- def toTry[T](result: JsResult[T], err: (JsError) => Throwable = Exception(_)): Try[T]
Returns a JSON validation as a scala.util.Try.
Returns a JSON validation as a scala.util.Try.
- T
the type for the parsing
- result
the JSON validation result
- err
the function to be applied if the results is an error
import scala.concurrent.Future import play.api.libs.json.JsResult def toFuture[T](res: JsResult[T]): Future[T] = Future.fromTry(JsResult.toTry(res))