JsResult

object JsResult
Companion
class
trait Sum
trait Mirror
class Object
trait Matchable
class Any

Type members

Classlikes

case class Exception(cause: JsError) extends Exception with NoStackTrace

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Inherited from
Mirror

Value members

Concrete methods

def fromTry[T](result: Try[T], err: Throwable => JsError): JsResult[T]

Returns a scala.util.Try as JSON validation.

Returns a scala.util.Try as JSON validation.

Type Params
T

the type for the parsing

Value Params
err

the function to be applied for scala.util.Failure

result

the result

def toTry[T](result: JsResult[T], err: JsError => Throwable): Try[T]

Returns a JSON validation as a scala.util.Try.

Returns a JSON validation as a scala.util.Try.

Type Params
T

the type for the parsing

Value Params
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))
result

the JSON validation result

Implicits

Implicits

implicit def alternativeJsResult(implicit a: Applicative[[A] =>> JsResult[A]]): Alternative[[A] =>> JsResult[A]]
implicit val applicativeJsResult: Applicative[[A] =>> JsResult[A]]
implicit val functorJsResult: Functor[[A] =>> JsResult[A]]