Packages

t

play.api.libs.json

DefaultWrites

trait DefaultWrites extends LowPriorityWrites

Default Serializers.

Source
Writes.scala
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DefaultWrites
  2. LowPriorityWrites
  3. EnvWrites
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
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
    EnvWrites

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 val DefaultInstantWrites: Writes[Instant]

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

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

    Definition Classes
    EnvWrites
  5. implicit val DefaultLocalDateTimeWrites: Writes[LocalDateTime]

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

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

    Definition Classes
    EnvWrites
  6. implicit val DefaultLocalDateWrites: Writes[LocalDate]

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

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

    Definition Classes
    EnvWrites
  7. implicit val DefaultLocalTimeWrites: Writes[LocalTime]

    The default typeclass to write a java.time.LocalTime, using '10:15:30' format.

    The default typeclass to write a java.time.LocalTime, using '10:15:30' format.

    Definition Classes
    EnvWrites
  8. implicit val DefaultOffsetDateTimeWrites: Writes[OffsetDateTime]

    The default typeclass to write a java.time.OffsetDateTime, using '2011-12-03T10:15:30+02:00' format.

    The default typeclass to write a java.time.OffsetDateTime, using '2011-12-03T10:15:30+02:00' format.

    Definition Classes
    EnvWrites
  9. implicit val DefaultZonedDateTimeWrites: Writes[ZonedDateTime]

    The default typeclass to write a java.time.ZonedDateTime, using '2011-12-03T10:15:30+01:00[Europe/Paris]' format.

    The default typeclass to write a java.time.ZonedDateTime, using '2011-12-03T10:15:30+01:00[Europe/Paris]' format.

    Definition Classes
    EnvWrites
  10. val InstantEpochMilliWrites: Writes[Instant]

    Serializer for java.time.Instant as JSON number.

    Serializer for java.time.Instant as JSON number. The number of milliseconds since epoch is used.

    import java.time.Instant
    import play.api.libs.json.Writes
    
    implicit val inWrites: Writes[Instant] = Writes.InstantEpochMilliWrites
    Definition Classes
    EnvWrites
  11. val LocalDateEpochMilliWrites: Writes[LocalDate]

    Serializer for java.time.LocalDate as JSON number.

    Serializer for java.time.LocalDate as JSON number. The number of milliseconds since epoch is used.

    import java.time.LocalDate
    import play.api.libs.json.Writes
    
    implicit val ldnWrites: Writes[LocalDate] =
      Writes.LocalDateEpochMilliWrites
    Definition Classes
    EnvWrites
  12. val LocalDateTimeEpochMilliWrites: Writes[LocalDateTime]

    Serializer for java.time.LocalDateTime as JSON number.

    Serializer for java.time.LocalDateTime as JSON number. The number of milliseconds since epoch is used.

    import java.time.LocalDateTime
    import play.api.libs.json.Writes
    
    implicit val ldtnWrites = Writes.LocalDateTimeEpochMilliWrites
    Definition Classes
    EnvWrites
  13. val LocalTimeNanoOfDayWrites: Writes[LocalTime]

    Serializer for java.time.LocalTime as JSON number.

    Serializer for java.time.LocalTime as JSON number. The nano of day is written.

    import java.time.LocalTime
    import play.api.libs.json.Writes
    
    implicit val ltnWrites = Writes.LocalTimeNanoOfDayWrites
    Definition Classes
    EnvWrites
  14. implicit val NoneWrites: Writes[None.type]

    Serializer for JsNull.

    Serializer for JsNull.

    import play.api.libs.json.Json
    
    Json.obj("foo" -> None)
    // equivalent to Json.obj("foo" -> JsNull)
  15. implicit def OptionWrites[T](implicit fmt: Writes[T]): Writes[Option[T]]

    Serializer for Option.

  16. implicit val ZoneIdWrites: Writes[ZoneId]

    Serializer for java.time.ZoneId as JSON string.

    Serializer for java.time.ZoneId as JSON string.

    Definition Classes
    EnvWrites
  17. val ZonedDateTimeEpochMilliWrites: Writes[ZonedDateTime]

    Serializer for java.time.ZonedDateTime as JSON number.

    Serializer for java.time.ZonedDateTime as JSON number. The number of milliseconds since epoch is used.

    import java.time.ZonedDateTime
    import play.api.libs.json.Writes
    
    implicit val zdtnWrites = Writes.ZonedDateTimeEpochMilliWrites
    Definition Classes
    EnvWrites
  18. implicit def arrayWrites[T](implicit arg0: ClassTag[T], arg1: Writes[T]): Writes[Array[T]]

    Serializer for Array[T] types.

  19. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  20. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  21. def dateWrites(pattern: String): Writes[Date]

    Serializer for java.util.Date

    Serializer for java.util.Date

    pattern

    the pattern used by SimpleDateFormat

  22. implicit def defaultDateWrites[T <: Date]: Writes[T]

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

  23. implicit def enumNameWrites[E <: Enumeration]: Writes[enumNameWrites.E.Value]

    Serializer for scala.Enumeration by name.

  24. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  26. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. implicit def genericMapWrites[V, M[A, B] <: Map[A, B]](implicit w: Writes[V]): OWrites[M[String, V]]

    Serializer for Map[String,V] types.

  28. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  30. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  31. implicit def iterableWrites2[A, I](implicit ev: <:<[I, Iterable[A]], w: Writes[A]): Writes[I]

    Serializer for Iterable types.

    Serializer for Iterable types.

    Definition Classes
    LowPriorityWrites
  32. val javaDurationMillisWrites: Writes[Duration]

    Serializer of Java Duration as a number of milliseconds.

    Serializer of Java Duration as a number of milliseconds.

    Definition Classes
    EnvWrites
  33. implicit val javaDurationWrites: Writes[Duration]

    Serializer of Java Duration using ISO representation (e.g.

    Serializer of Java Duration using ISO representation (e.g. PT1S for 1 second).

    Definition Classes
    EnvWrites
  34. implicit val javaPeriodWrites: Writes[Period]

    Serializer of Java Period using ISO representation (e.g.

    Serializer of Java Period using ISO representation (e.g. P2D for 2 days).

    Definition Classes
    EnvWrites
  35. implicit def jsValueWrites[T <: JsValue]: Writes[T]

    Serializer for JsValues.

  36. implicit def jsonNodeWrites[T <: JsonNode]: Writes[T]

    Serializer for Jackson JsonNode

    Serializer for Jackson JsonNode

    Definition Classes
    EnvWrites
  37. implicit def keyMapWrites[K, V, M[K, V] <: Map[K, V]](implicit arg0: KeyWrites[K], arg1: Writes[V]): OWrites[M[K, V]]
  38. val localeObjectWrites: OWrites[Locale]

    Serializer for a Locale using a object representation

    Serializer for a Locale using a object representation

    Definition Classes
    EnvWrites
  39. implicit val localeWrites: Writes[Locale]

    Serializer for a Locale using the IETF BCP 47 string representation

    Serializer for a Locale using the IETF BCP 47 string representation

    Definition Classes
    EnvWrites
  40. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  41. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  42. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  43. implicit def rangeWrites[T <: Range]: Writes[T]

    Serializer for scala.collection.immutable.Range (aka specialized Seq of Int).

  44. implicit def someWrites[T](implicit w: Writes[T]): Writes[Some[T]]

    If Some is directly used (not as Option).

    If Some is directly used (not as Option).

    import play.api.libs.json.{ Json, Writes }
    
    def foo[T: Writes](writeableValue: T) =
      Json.obj("foo" -> Some(writeableValue))
      // equivalent to Json.obj("foo" -> writeableValue)
  45. implicit def stringableWrites[T](implicit conv: (T) ⇒ String): Writes[T]

    Serializer for any type that is provided an implicit conversion to String (e.g.

    Serializer for any type that is provided an implicit conversion to String (e.g. tagged types).

    Definition Classes
    LowPriorityWrites
  46. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  47. 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.

    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 java.time.format.DateTimeFormatter
    
    import play.api.libs.json.Writes
    
    implicit val w: Writes[LocalDateTime] =
      Writes.temporalWrites[LocalDateTime, DateTimeFormatter](
        DateTimeFormatter.ISO_LOCAL_DATE_TIME)
    Definition Classes
    EnvWrites
  48. def toString(): String
    Definition Classes
    AnyRef → Any
  49. implicit val uriWrites: Writes[URI]

    Serializer for java.net.URI

    Serializer for java.net.URI

    Definition Classes
    LowPriorityWrites
  50. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  53. implicit object BigDecimalWrites extends Writes[BigDecimal]

    Serializer for BigDecimal types.

  54. implicit object BigIntWrites extends Writes[BigInt]

    Serializer for BigInt type.

  55. implicit object BigIntegerWrites extends Writes[BigInteger]

    Serializer for BigInteger type.

  56. implicit object BooleanWrites extends Writes[Boolean]

    Serializer for Boolean types.

  57. implicit object ByteWrites extends Writes[Byte]

    Serializer for Byte types.

  58. implicit object DoubleWrites extends Writes[Double]

    Serializer for Double types.

  59. implicit object FloatWrites extends Writes[Float]

    Serializer for Float types.

  60. implicit object IntWrites extends Writes[Int]

    Serializer for Int types.

  61. implicit object LongWrites extends Writes[Long]

    Serializer for Long types.

  62. implicit object ShortWrites extends Writes[Short]

    Serializer for Short types.

  63. implicit object StringWrites extends Writes[String]

    Serializer for String types.

  64. implicit object UuidWrites extends Writes[UUID]

    Serializer for java.util.UUID

  65. object TemporalFormatter

    Formatting companion

    Formatting companion

    Definition Classes
    EnvWrites

Deprecated Value Members

  1. def iterableWrites[A, M[T] <: Iterable[T]](implicit w: Writes[A]): Writes[M[A]]

    Serializer for Iterable types.

    Serializer for Iterable types.

    Deprecated due to incompatibility with non _[_] shapes, #368.

    Definition Classes
    LowPriorityWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.1) Use iterableWrites2

  2. def jodaDateWrites(pattern: String): Writes[DateTime]
    Definition Classes
    EnvWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.jodaDateWrites

  3. def jodaLocalDateWrites(pattern: String): Writes[LocalDate]
    Definition Classes
    EnvWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.jodaLocalDateWrites

  4. def jodaLocalTimeWrites(pattern: String): Writes[LocalTime]
    Definition Classes
    EnvWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.jodaLocalTimeWrites

  5. implicit def mapWrites[V](implicit arg0: Writes[V]): OWrites[Map[String, V]]

    Serializer for Map[String,V] types.

    Serializer for Map[String,V] types.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) Use genericMapWrites

  6. def sqlDateWrites(pattern: String): Writes[Date]

    Serializer for java.sql.Date

    Serializer for java.sql.Date

    pattern

    the pattern used by SimpleDateFormat

    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) Use dateWrites

  7. def traversableWrites[A](implicit arg0: Writes[A]): Writes[Traversable[A]]
    Definition Classes
    LowPriorityWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) Use iterableWrites

  8. object DefaultDateWrites extends Writes[Date]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) Use defaultDateWrites

  9. object JsValueWrites extends Writes[JsValue]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) Use jsValueWrites

  10. object DefaultJodaDateWrites extends Writes[DateTime]
    Definition Classes
    EnvWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.JodaDateNumberWrites

  11. object DefaultJodaLocalDateWrites extends Writes[LocalDate]
    Definition Classes
    EnvWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.DefaultJodaLocalDateWrites

  12. object DefaultJodaLocalTimeWrites extends Writes[LocalTime]
    Definition Classes
    EnvWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.DefaultJodaLocalTimeWrites

  13. object JsonNodeWrites extends Writes[JsonNode]
    Definition Classes
    EnvWrites
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) Use jsonNodeWrites

Inherited from LowPriorityWrites

Inherited from EnvWrites

Inherited from AnyRef

Inherited from Any

Ungrouped