object OWrites extends PathWrites with ConstraintWrites

Source
Writes.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. OWrites
  2. ConstraintWrites
  3. PathWrites
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. def apply[A](f: (A) => JsObject): OWrites[A]

    Returns an instance which uses f as OWrites.writes function.

  2. def at[A](path: JsPath)(implicit wrs: Writes[A]): OWrites[A]
    Definition Classes
    PathWrites
  3. implicit val contravariantfunctorOWrites: [OWrites]
  4. implicit val functionalCanBuildOWrites: [OWrites]
  5. def jsPick(path: JsPath): [JsValue]
    Definition Classes
    PathWrites
  6. def jsPickBranch(path: JsPath): [JsValue]
    Definition Classes
    PathWrites
  7. def jsPickBranchUpdate(path: JsPath, wrs: [JsValue]): [JsValue]
    Definition Classes
    PathWrites
  8. def list[A](implicit writes: Writes[A]): Writes[List[A]]
    Definition Classes
    ConstraintWrites
  9. def map[A](implicit writes: Writes[A]): OWrites[Map[String, A]]
    Definition Classes
    ConstraintWrites
  10. def nullable[A](path: JsPath)(implicit wrs: Writes[A]): OWrites[Option[A]]

    writes a optional field in given JsPath : if None, doesn't write field at all.

    writes a optional field in given JsPath : if None, doesn't write field at all. Please note we do not write "null" but simply omit the field when None If you want to write a "null", use ConstraintWrites.optionWithNull[A]

    Definition Classes
    PathWrites
  11. def of[A](implicit w: OWrites[A]): OWrites[A]
  12. def of[A](implicit w: Writes[A]): Writes[A]
    Definition Classes
    ConstraintWrites
  13. def optionWithNull[A](implicit wa: Writes[A]): Writes[Option[A]]

    Pure Option Writer[T] which writes "null" when None which is different from JsPath.writeNullable which omits the field when None

    Pure Option Writer[T] which writes "null" when None which is different from JsPath.writeNullable which omits the field when None

    Definition Classes
    ConstraintWrites
  14. def pruned[A]: Writes[A]
    Definition Classes
    ConstraintWrites
  15. def pure[A](fixed: => A)(implicit wrs: OWrites[A]): [JsValue]
  16. def pure[A](fixed: => A)(implicit wrs: Writes[A]): [JsValue]
    Definition Classes
    ConstraintWrites
  17. def pure[A](path: JsPath, fixed: => A)(implicit wrs: Writes[A]): [JsValue]
    Definition Classes
    PathWrites
  18. def seq[A](implicit writes: Writes[A]): Writes[Seq[A]]
    Definition Classes
    ConstraintWrites
  19. def set[A](implicit writes: Writes[A]): Writes[Set[A]]
    Definition Classes
    ConstraintWrites
  20. def transform[A](w: OWrites[A])(f: (A, ) => JsObject): OWrites[A]

    Transforms the resulting JsObject using the given function, which is also applied with the initial input.

    Transforms the resulting JsObject using the given function, which is also applied with the initial input.

    w

    the initial writer

    f

    the transformer function

  21. def tuple2[A, B](name1: String, name2: String)(implicit arg0: Writes[A], arg1: Writes[B]): OWrites[(A, B)]

    Writes a tuple of two values to a JSON object, with custom field names.

    Writes a tuple of two values to a JSON object, with custom field names.

    A

    the type of the first value

    B

    the type of the second value

    val tuple2Writes: OWrites[(String, Int)] =
      OWrites.tuple2[String, Int]("name", "age")
    
    tuple2Writes.writes("Bob" -> 30) // {"name":"Bob","age":30}
    name1

    the name of the first field

    name2

    the name of the second field

  22. def tuple3[A, B, C](name1: String, name2: String, name3: String)(implicit arg0: Writes[A], arg1: Writes[B], arg2: Writes[C]): OWrites[(A, B, C)]

    Writes a tuple of three values to a JSON object, with custom field names.

    Writes a tuple of three values to a JSON object, with custom field names.

    A

    the type of the first value

    B

    the type of the second value

    C

    the type of the third value

    val tuple3Writes: OWrites[(String, Int, Boolean)] =
      OWrites.tuple3[String, Int, Boolean]("name", "age", "isStudent")
    
    tuple3Writes.writes(("Bob", 30, false))
    // {"name":"Bob","age":30,"isStudent":false}
    name1

    the name of the first field

    name2

    the name of the second field

    name3

    the name of the third field

  23. def tuple4[A, B, C, D](name1: String, name2: String, name3: String, name4: String)(implicit arg0: Writes[A], arg1: Writes[B], arg2: Writes[C], arg3: Writes[D]): OWrites[(A, B, C, D)]

    Writes a tuple of four values to a JSON object, with custom field names.

    Writes a tuple of four values to a JSON object, with custom field names.

    A

    the type of the first value

    B

    the type of the second value

    C

    the type of the third value

    D

    the type of the fourth value

    val tuple4Writes: OWrites[(String, Int, Boolean, Double)] =
      OWrites.tuple4[String, Int, Boolean, Double]("name", "age", "isStudent", "score")
    
    tuple4Writes.writes(("Bob", 30, false, 91.2))
    // {"name":"Bob","age":30,"isStudent":false,"score":91.2}
    name1

    the name of the first field

    name2

    the name of the second field

    name3

    the name of the third field

    name4

    the name of the fourth field

Deprecated Value Members

  1. def pruned[A](implicit w: Writes[A]): Writes[A]
    Definition Classes
    ConstraintWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) Use pruned without Writes[A]