play.api.libs.json

Writes

Related Docs: trait Writes | package json

object Writes extends PathWrites with ConstraintWrites with DefaultWrites

Default Serializers.

Source
Writes.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Writes
  2. DefaultWrites
  3. ConstraintWrites
  4. PathWrites
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait TemporalFormatter[T <: Temporal] extends AnyRef

    Typeclass to implement way of formatting of Java8 temporal types.

    Typeclass to implement way of formatting of Java8 temporal types.

    Definition Classes
    DefaultWrites

Value Members

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

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

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. implicit object BigDecimalWrites extends Writes[BigDecimal]

    Serializer for BigDecimal types.

    Serializer for BigDecimal types.

    Definition Classes
    DefaultWrites
  5. implicit object BooleanWrites extends Writes[Boolean]

    Serializer for Boolean types.

    Serializer for Boolean types.

    Definition Classes
    DefaultWrites
  6. implicit object ByteWrites extends Writes[Byte]

    Serializer for Byte types.

    Serializer for Byte types.

    Definition Classes
    DefaultWrites
  7. implicit object DefaultDateWrites extends Writes[Date]

    Default Serializer java.util.Date -> JsNumber(d.getTime (nb of ms))

    Default Serializer java.util.Date -> JsNumber(d.getTime (nb of ms))

    Definition Classes
    DefaultWrites
  8. implicit val DefaultInstantWrites: Writes[Instant]

    The default typeclass to write a java.time.Instant, using '2011-12-03T10:15:30' format, and default time zone.

    The default typeclass to write a java.time.Instant, using '2011-12-03T10:15:30' format, and default time zone.

    Definition Classes
    DefaultWrites
  9. implicit object DefaultJodaDateWrites extends Writes[DateTime]

    Default Serializer org.joda.time.DateTime -> JsNumber(d.getMillis (nb of ms))

    Default Serializer org.joda.time.DateTime -> JsNumber(d.getMillis (nb of ms))

    Definition Classes
    DefaultWrites
  10. implicit object DefaultJodaLocalDateWrites extends Writes[LocalDate]

    Default Serializer org.joda.time.LocalDate -> JsString(ISO8601 format (yyyy-MM-dd))

    Default Serializer org.joda.time.LocalDate -> JsString(ISO8601 format (yyyy-MM-dd))

    Definition Classes
    DefaultWrites
  11. implicit object DefaultJodaLocalTimeWrites extends Writes[LocalTime]

    Default Serializer org.joda.time.LocalDate -> JsString(ISO8601 format (HH:mm:ss.SSS))

    Default Serializer org.joda.time.LocalDate -> JsString(ISO8601 format (HH:mm:ss.SSS))

    Definition Classes
    DefaultWrites
  12. implicit val DefaultLocalDateTimeWrites: Writes[LocalDateTime]

    The default typeclass to write a java.time.LocalDateTime, using '2011-12-03T10:15:30' format, and default time zone.

    The default typeclass to write a java.time.LocalDateTime, using '2011-12-03T10:15:30' format, and default time zone.

    Definition Classes
    DefaultWrites
  13. implicit val DefaultLocalDateWrites: Writes[LocalDate]

    The default typeclass to write a java.time.LocalDate, using '2011-12-03' format, and default time zone.

    The default typeclass to write a java.time.LocalDate, using '2011-12-03' format, and default time zone.

    Definition Classes
    DefaultWrites
  14. implicit val DefaultZonedDateTimeWrites: Writes[ZonedDateTime]

    The default typeclass to write a java.time.ZonedDateTime, using '2011-12-03T10:15:30' format, and default time zone.

    The default typeclass to write a java.time.ZonedDateTime, using '2011-12-03T10:15:30' format, and default time zone.

    Definition Classes
    DefaultWrites
  15. implicit object DoubleWrites extends Writes[Double]

    Serializer for Double types.

    Serializer for Double types.

    Definition Classes
    DefaultWrites
  16. implicit object FloatWrites extends Writes[Float]

    Serializer for Float types.

    Serializer for Float types.

    Definition Classes
    DefaultWrites
  17. val InstantNumberWrites: Writes[Instant]

    Serializer for java.time.Instant as JSON number.

    Serializer for java.time.Instant as JSON number.

    import java.time.Instant
    import play.api.libs.json.Writes
    
    implicit val inWrites = Writes.InstantNumberWrites
    Definition Classes
    DefaultWrites
  18. implicit object IntWrites extends Writes[Int]

    Serializer for Int types.

    Serializer for Int types.

    Definition Classes
    DefaultWrites
  19. implicit object JsValueWrites extends Writes[JsValue]

    Serializer for JsValues.

    Serializer for JsValues.

    Definition Classes
    DefaultWrites
  20. implicit object JsonNodeWrites extends Writes[JsonNode]

    Serializer for Jackson JsonNode

    Serializer for Jackson JsonNode

    Definition Classes
    DefaultWrites
  21. val LocalDateNumberWrites: Writes[LocalDate]

    Serializer for java.time.LocalDate as JSON number.

    Serializer for java.time.LocalDate as JSON number.

    import java.time.LocalDate
    import play.api.libs.json.Writes
    
    implicit val ldnWrites = Writes.LocalDateNumberWrites
    Definition Classes
    DefaultWrites
  22. val LocalDateTimeNumberWrites: Writes[LocalDateTime]

    Serializer for java.time.LocalDateTime as JSON number.

    Serializer for java.time.LocalDateTime as JSON number.

    import java.time.LocalDateTime
    import play.api.libs.json.Writes
    
    implicit val ldtnWrites = Writes.LocalDateTimeNumberWrites
    Definition Classes
    DefaultWrites
  23. implicit object LongWrites extends Writes[Long]

    Serializer for Long types.

    Serializer for Long types.

    Definition Classes
    DefaultWrites
  24. implicit def OptionWrites[T](implicit fmt: Writes[T]): Writes[Option[T]]

    Serializer for Option.

    Serializer for Option.

    Definition Classes
    DefaultWrites
  25. implicit object ShortWrites extends Writes[Short]

    Serializer for Short types.

    Serializer for Short types.

    Definition Classes
    DefaultWrites
  26. implicit object StringWrites extends Writes[String]

    Serializer for String types.

    Serializer for String types.

    Definition Classes
    DefaultWrites
  27. object TemporalFormatter

    Formatting companion

    Formatting companion

    Definition Classes
    DefaultWrites
  28. implicit object UuidWrites extends Writes[UUID]

    Serializer for java.util.UUID

    Serializer for java.util.UUID

    Definition Classes
    DefaultWrites
  29. val ZonedDateTimeNumberWrites: Writes[ZonedDateTime]

    Serializer for java.time.ZonedDateTime as JSON number.

    Serializer for java.time.ZonedDateTime as JSON number.

    import java.time.ZonedDateTime
    import play.api.libs.json.Writes
    
    implicit val zdtnWrites = Writes.ZonedDateTimeNumberWrites
    Definition Classes
    DefaultWrites
  30. def apply[A](f: (A) ⇒ JsValue): Writes[A]

  31. implicit def arrayWrites[T](implicit arg0: ClassTag[T], fmt: Writes[T]): Writes[Array[T]]

    Serializer for Array[T] types.

    Serializer for Array[T] types.

    Definition Classes
    DefaultWrites
  32. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  33. def at[A](path: JsPath)(implicit wrs: Writes[A]): OWrites[A]

    Definition Classes
    PathWrites
  34. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. val constraints: ConstraintWrites

  36. def dateWrites(pattern: String): Writes[Date]

    Serializer for java.util.Date

    Serializer for java.util.Date

    pattern

    the pattern used by SimpleDateFormat

    Definition Classes
    DefaultWrites
  37. implicit def enumNameWrites[E <: Enumeration]: Writes[DefaultWrites.enumNameWrites.E.Value]

    Serializer for scala.Enumeration by name.

    Serializer for scala.Enumeration by name.

    Definition Classes
    DefaultWrites
  38. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  39. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  40. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  41. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  42. def hashCode(): Int

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

    Definition Classes
    Any
  44. def jodaDateWrites(pattern: String): Writes[DateTime]

    Serializer for org.joda.time.DateTime

    Serializer for org.joda.time.DateTime

    pattern

    the pattern used by SimpleDateFormat

    Definition Classes
    DefaultWrites
  45. def jodaLocalDateWrites(pattern: String): Writes[LocalDate]

    Serializer for org.joda.time.LocalDate

    Serializer for org.joda.time.LocalDate

    pattern

    the pattern used by org.joda.time.format.DateTimeFormat

    Definition Classes
    DefaultWrites
  46. def jodaLocalTimeWrites(pattern: String): Writes[LocalTime]

    Serializer for org.joda.time.LocalTime

    Serializer for org.joda.time.LocalTime

    pattern

    the pattern used by org.joda.time.format.DateTimeFormat

    Definition Classes
    DefaultWrites
  47. def jsPick(path: JsPath): Writes[JsValue]

    Definition Classes
    PathWrites
  48. def jsPickBranch(path: JsPath): OWrites[JsValue]

    Definition Classes
    PathWrites
  49. def jsPickBranchUpdate(path: JsPath, wrs: OWrites[JsValue]): OWrites[JsValue]

    Definition Classes
    PathWrites
  50. def list[A](implicit writes: Writes[A]): Writes[List[A]]

    Definition Classes
    ConstraintWrites
  51. def map[A](implicit writes: Writes[A]): OWrites[Map[String, A]]

    Definition Classes
    ConstraintWrites
  52. implicit def mapWrites[V](implicit fmtv: Writes[V]): OWrites[Map[String, V]]

    Serializer for Map[String,V] types.

    Serializer for Map[String,V] types.

    Definition Classes
    DefaultWrites
  53. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  54. final def notify(): Unit

    Definition Classes
    AnyRef
  55. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  56. 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
  57. def of[A](implicit w: Writes[A]): Writes[A]

    Definition Classes
    ConstraintWrites
  58. 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
  59. val path: PathWrites

  60. def pruned[A](implicit w: Writes[A]): Writes[A]

    Definition Classes
    ConstraintWrites
  61. def pure[A](fixed: ⇒ A)(implicit wrs: Writes[A]): Writes[JsValue]

    Definition Classes
    ConstraintWrites
  62. def pure[A](path: JsPath, fixed: ⇒ A)(implicit wrs: Writes[A]): OWrites[JsValue]

    Definition Classes
    PathWrites
  63. def seq[A](implicit writes: Writes[A]): Writes[Seq[A]]

    Definition Classes
    ConstraintWrites
  64. def set[A](implicit writes: Writes[A]): Writes[Set[A]]

    Definition Classes
    ConstraintWrites
  65. def sqlDateWrites(pattern: String): Writes[Date]

    Serializer for java.sql.Date

    Serializer for java.sql.Date

    pattern

    the pattern used by SimpleDateFormat

    Definition Classes
    DefaultWrites
  66. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  67. def temporalWrites[A <: Temporal, B](formatting: B)(implicit f: (B) ⇒ TemporalFormatter[A]): Writes[A]

    Serializer for Java8 temporal types (e.g.

    Serializer for Java8 temporal types (e.g. java.time.LocalDateTime) to be written as JSON string, using the default time zone.

    A

    the Java8 temporal type to be considered: LocalDateTime, ZonedDateTime, Instant

    B

    Type of formatting argument

    formatting

    an argument to instantiate formatter

    import java.time.LocalDateTime
    import play.api.libs.json.Writes
    
    implicit val temporalWrites: Writes[LocalDateTime] =
      temporalWrites[LocalDateTime, DateTimeFormatter](
        DateTimeFormatter.ISO_LOCAL_DATE_TIME)
    Definition Classes
    DefaultWrites
  68. def toString(): String

    Definition Classes
    AnyRef → Any
  69. implicit def traversableWrites[A](implicit arg0: Writes[A]): Writes[Traversable[A]] { def writes(as: Traversable[A]): play.api.libs.json.JsArray }

    Serializer for Traversables types.

    Serializer for Traversables types.

    Definition Classes
    DefaultWrites
  70. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from DefaultWrites

Inherited from ConstraintWrites

Inherited from PathWrites

Inherited from AnyRef

Inherited from Any

Ungrouped