Packages

object JsResult

Source
JsResult.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsResult
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. case class Exception(cause: JsError) extends java.lang.Exception with NoStackTrace with Product with Serializable

Value Members

  1. implicit def alternativeJsResult(implicit a: Applicative[JsResult]): Alternative[JsResult]
  2. implicit val applicativeJsResult: Applicative[JsResult]
  3. 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

  4. implicit val functorJsResult: Functor[JsResult]
  5. 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))