Class/Object

play.api.libs.json

JsPath

Related Docs: object JsPath | package json

Permalink

case class JsPath(path: List[PathNode] = List()) extends Product with Serializable

Path to a JsValue; As for path to file on FS, there may not be any matching value in the parsed JSON.

Source
JsPath.scala
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsPath
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new JsPath(path: List[PathNode] = List())

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def ++(other: JsPath): JsPath

    Permalink
  4. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  5. def \(idx: Int): JsPath

    Permalink
  6. def \(child: Symbol): JsPath

    Permalink
  7. def \(child: String): JsPath

    Permalink
  8. def \\(child: Symbol): JsPath

    Permalink
  9. def \\(child: String): JsPath

    Permalink
  10. def apply(json: JsValue): List[JsValue]

    Permalink
  11. def apply(idx: Int): JsPath

    Permalink
  12. def applyTillLast(json: JsValue): Either[JsError, JsResult[JsValue]]

    Permalink
  13. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  14. def asSingleJsResult(json: JsValue): JsResult[JsValue]

    Permalink
  15. def asSingleJson(json: JsValue): JsLookupResult

    Permalink
  16. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. def compose(other: JsPath): JsPath

    Permalink
  18. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def format[T](w: Writes[T])(implicit r: Reads[T]): OFormat[T]

    Permalink

    Reads/Writes a T at JsPath using provided explicit Writes[T] and implicit Reads[T]

  21. def format[T](r: Reads[T])(implicit w: Writes[T]): OFormat[T]

    Permalink

    Reads/Writes a T at JsPath using provided explicit Reads[T] and implicit Writes[T]

  22. def format[T](implicit f: Format[T]): OFormat[T]

    Permalink

    Reads/Writes a T at JsPath using provided implicit Format[T]

  23. def formatNullable[T](implicit f: Format[T]): OFormat[Option[T]]

    Permalink

    Reads/Writes a Option[T] (optional or nullable field) at given JsPath

    Reads/Writes a Option[T] (optional or nullable field) at given JsPath

    See also

    JsPath.writeNullable to see behavior in writes

    JsPath.readNullable to see behavior in reads

  24. def formatNullableWithDefault[T](defaultValue: ⇒ Option[T])(implicit f: Format[T]): OFormat[Option[T]]

    Permalink

    Reads/Writes a Option[T] (nullable field) at given JsPath

    Reads/Writes a Option[T] (nullable field) at given JsPath

    See also

    JsPath.writeNullable to see behavior in writes

    JsPath.readNullableWithDefault to see behavior in reads

  25. def formatWithDefault[T](defaultValue: ⇒ T)(implicit f: Format[T]): OFormat[T]

    Permalink

    Reads/Writes a T at JsPath using provided implicit Format[T] with fallback to default value

  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. object json

    Permalink
  29. def lazyFormat[T](r: ⇒ Reads[T], w: ⇒ Writes[T]): OFormat[T]

    Permalink

    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).

    See also

    JsPath.lazyWriteNullable to see behavior in writes

    JsPath.lazyReadNullable to see behavior in reads

  30. def lazyFormat[T](f: ⇒ Format[T]): OFormat[T]

    Permalink

    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).

    See also

    JsPath.lazyWriteNullable to see behavior in writes

    JsPath.lazyReadNullable to see behavior in reads

  31. def lazyFormatNullable[T](r: ⇒ Reads[T], w: ⇒ Writes[T]): OFormat[Option[T]]

    Permalink

    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).

    See also

    JsPath.lazyWriteNullable to see behavior in writes

    JsPath.lazyReadNullable to see behavior in reads

  32. def lazyFormatNullable[T](f: ⇒ Format[T]): OFormat[Option[T]]

    Permalink

    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).

    See also

    JsPath.lazyWriteNullable to see behavior in writes

    JsPath.lazyReadNullable to see behavior in reads

  33. def lazyRead[T](r: ⇒ Reads[T]): Reads[T]

    Permalink

    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.

    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 _)
  34. def lazyReadNullable[T](r: ⇒ Reads[T]): Reads[Option[T]]

    Permalink

    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.

    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 _)
  35. def lazyWrite[T](w: ⇒ Writes[T]): OWrites[T]

    Permalink

    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

    case class User(id: Long, name: String, friend: User)
    
    implicit lazy val UserReads: Reads[User] = (
      (__ \ 'id).write[Long] and
      (__ \ 'name).write[String] and
      (__ \ 'friend).lazyWrite(UserReads)
    )(User.apply _)
  36. def lazyWriteNullable[T](w: ⇒ Writes[T]): OWrites[Option[T]]

    Permalink

    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

    case class User(id: Long, name: String, friend: Option[User])
    
    implicit lazy val UserReads: Reads[User] = (
      (__ \ 'id).write[Long] and
      (__ \ 'name).write[String] and
      (__ \ 'friend).lazyWriteNullable(UserReads)
    )(User.apply _)
  37. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  38. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  39. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  40. val path: List[PathNode]

    Permalink
  41. def prune(js: JsValue): JsResult[JsObject]

    Permalink

    Simple Prune for simple path and only JsObject

  42. def read[T](t: T): Reads[T]

    Permalink

    Pure Reads doesn't read anything but creates a JsObject based on JsPath with the given T value

  43. def read[T](implicit r: Reads[T]): Reads[T]

    Permalink

    Reads a T at JsPath

  44. def readNullable[T](implicit r: Reads[T]): Reads[Option[T]]

    Permalink

    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 except last node: - If one node in JsPath is not found before last node => returns JsError( "missing-path" ) - If all nodes are found till last node, it runs through JsValue with last node =>

    • If last node is not found => returns None
    • If last node is found with value "null" => returns None
    • If last node is found => applies implicit Reads[T]
  45. def readNullableWithDefault[T](defaultValue: ⇒ Option[T])(implicit r: Reads[T]): Reads[Option[T]]

    Permalink

    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 one node in JsPath is not found before last node => returns JsError( "missing-path" ) - If all nodes are found till last node, it runs through JsValue with last node =>

    • If last node is not found => returns default value
    • If last node is found with value "null" => returns None
    • If last node is found => applies implicit Reads[T]
  46. def readWithDefault[T](defaultValue: ⇒ T)(implicit r: Reads[T]): Reads[T]

    Permalink

    Reads a T at JsPath

  47. def rw[T](implicit r: Reads[T], w: Writes[T]): OFormat[T]

    Permalink

    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

  48. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  49. def toJsonString: String

    Permalink
  50. def toString(): String

    Permalink
    Definition Classes
    JsPath → AnyRef → Any
  51. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  53. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. def write[T](t: T)(implicit w: Writes[T]): OWrites[JsValue]

    Permalink

    Writes a pure value at given JsPath

  55. def write[T](implicit w: Writes[T]): OWrites[T]

    Permalink

    Writes a T at given JsPath

  56. def writeNullable[T](implicit w: Writes[T]): OWrites[Option[T]]

    Permalink

    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]

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped