object OWrites extends PathWrites with ConstraintWrites
- Source
- Writes.scala
- Alphabetic
- By Inheritance
- OWrites
- ConstraintWrites
- PathWrites
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- def apply[A](f: (A) => JsObject): OWrites[A]
Returns an instance which uses
f
as OWrites.writes function. - def at[A](path: JsPath)(implicit wrs: Writes[A]): OWrites[A]
- Definition Classes
- PathWrites
- implicit val contravariantfunctorOWrites: [OWrites]
- implicit val functionalCanBuildOWrites: [OWrites]
- def jsPick(path: JsPath): [JsValue]
- Definition Classes
- PathWrites
- def jsPickBranch(path: JsPath): [JsValue]
- Definition Classes
- PathWrites
- def jsPickBranchUpdate(path: JsPath, wrs: [JsValue]): [JsValue]
- Definition Classes
- PathWrites
- def list[A](implicit writes: Writes[A]): Writes[List[A]]
- Definition Classes
- ConstraintWrites
- def map[A](implicit writes: Writes[A]): OWrites[Map[String, A]]
- Definition Classes
- ConstraintWrites
- 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
- def of[A](implicit w: OWrites[A]): OWrites[A]
- def of[A](implicit w: Writes[A]): Writes[A]
- Definition Classes
- ConstraintWrites
- 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 NonePure Option Writer[T] which writes "null" when None which is different from
JsPath.writeNullable
which omits the field when None- Definition Classes
- ConstraintWrites
- def pruned[A]: Writes[A]
- Definition Classes
- ConstraintWrites
- def pure[A](fixed: => A)(implicit wrs: OWrites[A]): [JsValue]
- def pure[A](fixed: => A)(implicit wrs: Writes[A]): [JsValue]
- Definition Classes
- ConstraintWrites
- def pure[A](path: JsPath, fixed: => A)(implicit wrs: Writes[A]): [JsValue]
- Definition Classes
- PathWrites
- def seq[A](implicit writes: Writes[A]): Writes[Seq[A]]
- Definition Classes
- ConstraintWrites
- def set[A](implicit writes: Writes[A]): Writes[Set[A]]
- Definition Classes
- ConstraintWrites
- 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
- 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
- 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
- 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
- def pruned[A](implicit w: Writes[A]): Writes[A]
- Definition Classes
- ConstraintWrites
- Annotations
- @deprecated
- Deprecated
(Since version 2.8.0) Use
pruned
withoutWrites[A]