JsDefined

play.api.libs.json.JsDefined
final case class JsDefined(value: JsValue) extends AnyVal, JsLookupResult

Wrapper for JsValue to represent an existing Json value.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait JsReadable
class AnyVal
trait Matchable
class Any
Show all

Members list

Value members

Inherited 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

Inherited from:
JsReadable
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.

Inherited from:
JsReadable
def get: JsValue

Attributes

Inherited from:
JsLookupResult
def getOrElse(v: => JsValue): JsValue

Attributes

Inherited from:
JsLookupResult
def isDefined: Boolean

Attributes

Inherited from:
JsLookupResult
def isEmpty: Boolean

Attributes

Inherited from:
JsLookupResult
def orElse(alternative: => JsLookupResult): JsLookupResult

If this result is defined return this. Otherwise return alternative.

If this result is defined return this. Otherwise return alternative.

Attributes

Inherited from:
JsLookupResult
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Attributes

Inherited from:
JsLookupResult
def toOption: Option[JsValue]

Tries to convert the node into a JsValue

Tries to convert the node into a JsValue

Attributes

Inherited from:
JsLookupResult
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

Inherited from:
JsReadable
def validate[A](implicit rds: Reads[A]): JsResult[A]

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

Inherited from:
JsLookupResult
def validateOpt[A](implicit rds: Reads[A]): JsResult[Option[A]]

If this result contains JsNull or is undefined, returns JsSuccess(None). Otherwise returns the result of validating as an A and wrapping the result in a Some.

If this result contains JsNull or is undefined, returns JsSuccess(None). Otherwise returns the result of validating as an A and wrapping the result in a Some.

Attributes

Inherited from:
JsLookupResult