object JsPath extends JsPath
Companion object and root path.
For an object { "name": "foo" }
, the path to the name
property is:
import play.api.libs.json.JsPath JsPath \ "name"
For an object { "id": 1, "nested": { "score": 0.12 } }
,
the path to the nested score
is:
import play.api.libs.json.JsPath JsPath \ "nested" \ "score"
- Source
- JsPath.scala
- Alphabetic
- By Inheritance
- JsPath
- JsPath
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def ++(other: JsPath): JsPath
- Definition Classes
- JsPath
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def \(idx: Int): JsPath
- Definition Classes
- JsPath
- def \(child: Symbol): JsPath
- Definition Classes
- JsPath
- def \(child: String): JsPath
- Definition Classes
- JsPath
- def \\(child: Symbol): JsPath
- Definition Classes
- JsPath
- def \\(child: String): JsPath
- Definition Classes
- JsPath
- def apply(json: JsValue): List[JsValue]
- Definition Classes
- JsPath
- def apply(idx: Int): JsPath
- Definition Classes
- JsPath
- def applyTillLast(json: JsValue): Either[JsError, JsResult[JsValue]]
- Definition Classes
- JsPath
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asSingleJsResult(json: JsValue): JsResult[JsValue]
- Definition Classes
- JsPath
- def asSingleJson(json: JsValue): JsLookupResult
- Definition Classes
- JsPath
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def compose(other: JsPath): JsPath
- Definition Classes
- JsPath
- def createObj(pathValues: (JsPath, JsValue)*): JsObject
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def format[T](w: Writes[T])(implicit r: Reads[T]): OFormat[T]
Reads/Writes a T at JsPath using provided explicit Writes[T] and implicit Reads[T]
Reads/Writes a T at JsPath using provided explicit Writes[T] and implicit Reads[T]
- Definition Classes
- JsPath
- def format[T](r: Reads[T])(implicit w: Writes[T]): OFormat[T]
Reads/Writes a T at JsPath using provided explicit Reads[T] and implicit Writes[T]
Reads/Writes a T at JsPath using provided explicit Reads[T] and implicit Writes[T]
- Definition Classes
- JsPath
- def format[T](implicit f: Format[T]): OFormat[T]
Reads/Writes a T at JsPath using provided implicit Format[T]
Reads/Writes a T at JsPath using provided implicit Format[T]
- Definition Classes
- JsPath
- def formatNullable[T](implicit f: Format[T]): OFormat[Option[T]]
Reads/Writes a Option[T] (optional or nullable field) at given JsPath
Reads/Writes a Option[T] (optional or nullable field) at given JsPath
- Definition Classes
- JsPath
- See also
JsPath.readNullable to see behavior in reads
JsPath.writeNullable to see behavior in writes
- def formatNullableWithDefault[T](defaultValue: => Option[T])(implicit f: Format[T]): OFormat[Option[T]]
Reads/Writes a Option[T] (nullable field) at given JsPath
Reads/Writes a Option[T] (nullable field) at given JsPath
- Definition Classes
- JsPath
- See also
JsPath.readNullableWithDefault to see behavior in reads
JsPath.writeNullable to see behavior in writes
- def formatWithDefault[T](defaultValue: => T)(implicit f: Format[T]): OFormat[T]
Reads/Writes a T at JsPath using provided implicit Format[T] with fallback to default value
Reads/Writes a T at JsPath using provided implicit Format[T] with fallback to default value
- Definition Classes
- JsPath
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lazyFormat[T](r: => Reads[T], w: => Writes[T]): OFormat[T]
Lazy Reads/Writes a T at given JsPath using explicit Reads[T] and Writes[T] (useful in case of recursive case classes).
Lazy Reads/Writes a T at given JsPath using explicit Reads[T] and Writes[T] (useful in case of recursive case classes).
- Definition Classes
- JsPath
- See also
JsPath.lazyReadNullable to see behavior in reads
JsPath.lazyWriteNullable to see behavior in writes
- def lazyFormat[T](f: => Format[T]): OFormat[T]
Lazy Reads/Writes a T at given JsPath using implicit Format[T] (useful in case of recursive case classes).
Lazy Reads/Writes a T at given JsPath using implicit Format[T] (useful in case of recursive case classes).
- Definition Classes
- JsPath
- See also
JsPath.lazyReadNullable to see behavior in reads
JsPath.lazyWriteNullable to see behavior in writes
- def lazyFormatNullable[T](r: => Reads[T], w: => Writes[T]): OFormat[Option[T]]
Lazy Reads/Writes a Option[T] (optional or nullable field) at given JsPath using explicit Reads[T] and Writes[T] (useful in case of recursive case classes).
Lazy Reads/Writes a Option[T] (optional or nullable field) at given JsPath using explicit Reads[T] and Writes[T] (useful in case of recursive case classes).
- Definition Classes
- JsPath
- See also
JsPath.lazyReadNullable to see behavior in reads
JsPath.lazyWriteNullable to see behavior in writes
- def lazyFormatNullable[T](f: => Format[T]): OFormat[Option[T]]
Lazy Reads/Writes a Option[T] (optional or nullable field) at given JsPath using implicit Format[T] (useful in case of recursive case classes).
Lazy Reads/Writes a Option[T] (optional or nullable field) at given JsPath using implicit Format[T] (useful in case of recursive case classes).
- Definition Classes
- JsPath
- See also
JsPath.lazyReadNullable to see behavior in reads
JsPath.lazyWriteNullable to see behavior in writes
- def lazyRead[T](r: => Reads[T]): Reads[T]
Reads a T at JsPath using the explicit Reads[T] passed by name which is useful in case of recursive case classes for ex.
Reads a T at JsPath using the explicit Reads[T] passed by name which is useful in case of recursive case classes for ex.
import play.api.libs.functional.syntax._ import play.api.libs.json.{ Reads, __ } case class User(id: Long, name: String, friend: User) implicit lazy val UserReads: Reads[User] = ( (__ \ 'id).read[Long] and (__ \ 'name).read[String] and (__ \ 'friend).lazyRead(UserReads) )(User.apply _)
- Definition Classes
- JsPath
- def lazyReadNullable[T](r: => Reads[T]): Reads[Option[T]]
Reads lazily a Option[T] search optional or nullable field at JsPath using the explicit Reads[T] passed by name which is useful in case of recursive case classes for ex.
Reads lazily a Option[T] search optional or nullable field at JsPath using the explicit Reads[T] passed by name which is useful in case of recursive case classes for ex.
import play.api.libs.functional.syntax._ import play.api.libs.json.{ Reads, __ } case class User(id: Long, name: String, friend: Option[User]) implicit lazy val UserReads: Reads[User] = ( (__ \ 'id).read[Long] and (__ \ 'name).read[String] and (__ \ 'friend).lazyReadNullable(UserReads) )(User.apply _)
- Definition Classes
- JsPath
- def lazyWrite[T](w: => Writes[T]): OWrites[T]
Writes a T at JsPath using the explicit Writes[T] passed by name which is useful in case of recursive case classes for ex
Writes a T at JsPath using the explicit Writes[T] passed by name which is useful in case of recursive case classes for ex
import play.api.libs.functional.syntax._ import play.api.libs.json.{ Writes, __ } case class User(id: Long, name: String, friend: User) implicit lazy val UserWrites: Writes[User] = ( (__ \ 'id).write[Long] and (__ \ 'name).write[String] and (__ \ 'friend).lazyWrite(UserWrites) )(unlift(User.unapply))
- Definition Classes
- JsPath
- def lazyWriteNullable[T](w: => Writes[T]): OWrites[Option[T]]
Writes a Option[T] at JsPath using the explicit Writes[T] passed by name which is useful in case of recursive case classes for ex
Writes a Option[T] at JsPath using the explicit Writes[T] passed by name which is useful in case of recursive case classes for ex
Please note that it's not writeOpt to be coherent with readNullable
import play.api.libs.functional.syntax._ import play.api.libs.json.{ Writes, __ } case class User(id: Long, name: String, friend: Option[User]) implicit lazy val UserWrites: Writes[User] = ( (__ \ 'id).write[Long] and (__ \ 'name).write[String] and (__ \ 'friend).lazyWriteNullable(UserWrites) )(unlift(User.unapply))
- Definition Classes
- JsPath
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val path: List[PathNode]
- Definition Classes
- JsPath
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def prune(js: JsValue): JsResult[JsObject]
Simple Prune for simple path and only JsObject
Simple Prune for simple path and only JsObject
- Definition Classes
- JsPath
- def read[T](t: T): Reads[T]
Pure Reads doesn't read anything but creates a JsObject based on JsPath with the given T value
Pure Reads doesn't read anything but creates a JsObject based on JsPath with the given T value
- Definition Classes
- JsPath
- def read[T](implicit r: Reads[T]): Reads[T]
Reads a T at JsPath
Reads a T at JsPath
- Definition Classes
- JsPath
- def readNullable[T](implicit r: Reads[T]): Reads[Option[T]]
Reads a Option[T] search optional or nullable field at JsPath (field not found or null is None and other cases are Error).
Reads a Option[T] search optional or nullable field at JsPath (field not found or null is None and other cases are Error).
It runs through JsValue following all JsPath nodes on JsValue: - If any node in JsPath is not found => returns None - If any node in JsPath is found with value "null" => returns None - If the entire path is found => applies implicit Reads[T]
- Definition Classes
- JsPath
- def readNullableWithDefault[T](defaultValue: => Option[T])(implicit r: Reads[T]): Reads[Option[T]]
Reads an Option[T] search optional or nullable field at JsPath (field not found replaced by default value, null is None and other cases are Error).
Reads an Option[T] search optional or nullable field at JsPath (field not found replaced by default value, null is None and other cases are Error).
It runs through JsValue following all JsPath nodes on JsValue except last node: - If any node in JsPath is not found => returns default value - If any node in JsPath is found with value "null" => returns None - If the entire path is found => applies implicit Reads[T]
- Definition Classes
- JsPath
- def readWithDefault[T](defaultValue: => T)(implicit r: Reads[T]): Reads[T]
Reads a T at JsPath
Reads a T at JsPath
- Definition Classes
- JsPath
- def rw[T](implicit r: Reads[T], w: Writes[T]): OFormat[T]
Reads/Writes a T at JsPath using provided implicit Reads[T] and Writes[T]
Reads/Writes a T at JsPath using provided implicit Reads[T] and Writes[T]
Please note we couldn't call it "format" to prevent conflicts
- Definition Classes
- JsPath
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toJsonString: String
- Definition Classes
- JsPath
- def toString(): String
- Definition Classes
- JsPath → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def write[T](t: T)(implicit w: Writes[T]): OWrites[JsValue]
Writes a pure value at given JsPath
Writes a pure value at given JsPath
- Definition Classes
- JsPath
- def write[T](implicit w: Writes[T]): OWrites[T]
Writes a T at given JsPath
Writes a T at given JsPath
- Definition Classes
- JsPath
- def writeNullable[T](implicit w: Writes[T]): OWrites[Option[T]]
Writes a Option[T] at given JsPath If None => doesn't write the field (never writes null actually) else => writes the field using implicit Writes[T]
Writes a Option[T] at given JsPath If None => doesn't write the field (never writes null actually) else => writes the field using implicit Writes[T]
- Definition Classes
- JsPath
- def writeOptionWithNull[T](implicit w: Writes[T]): OWrites[Option[T]]
Writes a Option[T] at given JsPath If None => writes 'null' else => writes the field using implicit Writes[T]
Writes a Option[T] at given JsPath If None => writes 'null' else => writes the field using implicit Writes[T]
- Definition Classes
- JsPath
- object json
- Definition Classes
- JsPath