JsReadable

play.api.libs.json.JsReadable
trait JsReadable

A trait representing a Json node which can be read as an arbitrary type A using a Reads[A]

Attributes

Graph
Supertypes
class Any
Known subtypes
class JsDefined
class JsUndefined
trait JsValue
class JsArray
class JsBoolean
object JsFalse.type
object JsTrue.type
object JsNull.type
class JsNumber
class JsObject
class JsString
Show all

Members list

Value members

Abstract methods

def validate[T](implicit rds: Reads[T]): JsResult[T]

Tries to convert the node into a JsResult[T] (Success or Error). An implicit Reads[T] must be defined.

Tries to convert the node into a JsResult[T] (Success or Error). An implicit Reads[T] must be defined.

Attributes

Concrete methods

def as[T](implicit fjs: Reads[T]): T

Tries to convert the node into a T, throwing an exception if it can't. An implicit Reads[T] must be defined.

Tries to convert the node into a T, throwing an exception if it can't. An implicit Reads[T] must be defined.

Attributes

def asOpt[T](implicit fjs: Reads[T]): Option[T]

Tries to convert the node into a T. An implicit Reads[T] must be defined. Any error is mapped to None

Tries to convert the node into a T. An implicit Reads[T] must be defined. Any error is mapped to None

Attributes

Returns

Some[T] if it succeeds, None if it fails.

def transform[A <: JsValue](rds: Reads[A]): JsResult[A]

Transforms this node into a JsResult using provided Json transformer Reads[JsValue]

Transforms this node into a JsResult using provided Json transformer Reads[JsValue]

Attributes