Typeclass to implement way of formatting of Java8 temporal types.
Typeclass to implement way of formatting of Java8 temporal types.
Serializer for BigDecimal types.
Serializer for BigDecimal types.
Serializer for Boolean types.
Serializer for Boolean types.
Serializer for Byte types.
Serializer for Byte types.
Default Serializer java.util.Date -> JsNumber(d.getTime (nb of ms))
Default Serializer java.util.Date -> JsNumber(d.getTime (nb of ms))
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.
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.
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.
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.
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.
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.
Serializer for Double types.
Serializer for Double types.
Serializer for Float types.
Serializer for Float types.
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.InstantNumberWrites
Serializer for Int types.
Serializer for Int types.
Serializer for JsValues.
Serializer for JsValues.
Serializer for Jackson JsonNode
Serializer for Jackson JsonNode
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.LocalDateEpochMilliWrites
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
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.LocalTimeNumberWrites
Serializer for Long types.
Serializer for Long types.
Serializer for Option.
Serializer for Option.
Serializer for Short types.
Serializer for Short types.
Serializer for String types.
Serializer for String types.
Formatting companion
Formatting companion
Serializer for java.util.UUID
Serializer for java.util.UUID
Serializer for java.time.ZoneId
as JSON string.
Serializer for java.time.ZoneId
as JSON string.
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
Serializer for Array[T] types.
Serializer for Array[T] types.
Serializer for java.util.Date
Serializer for java.util.Date
the pattern used by SimpleDateFormat
Serializer for scala.Enumeration by name.
Serializer for scala.Enumeration by name.
Serializer of Java Duration as a number of milliseconds.
Serializer of Java Duration as a number of milliseconds.
Serializer of Java Duration using ISO representation (e.g.
Serializer of Java Duration using ISO representation (e.g. PT1S for 1 second).
Serializer of Java Period using ISO representation (e.g.
Serializer of Java Period using ISO representation (e.g. P2D for 2 days).
Serializer for a Locale
using a object representation
Serializer for a Locale
using a object representation
Serializer for a Locale
using the IETF BCP 47 string representation
Serializer for a Locale
using the IETF BCP 47 string representation
Serializer for Map[String,V] types.
Serializer for Map[String,V] types.
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]
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
Serializer for java.sql.Date
Serializer for java.sql.Date
the pattern used by SimpleDateFormat
Serializer for Java8 temporal types (e.g.
Serializer for Java8 temporal types (e.g. java.time.LocalDateTime
)
to be written as JSON string.
the Java8 temporal type to be considered: LocalDateTime, ZonedDateTime, Instant
Type of formatting argument
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)
Transforms the resulting JsValue using the given function, which is also applied with the initial input.
Transforms the resulting JsValue using the given function, which is also applied with the initial input. def transform(transformer: (A, JsValue) => JsValue): Writes[A] = Writes[A] { a => transformer(a, this.writes(a)) }
the initial writer
the transformer function
Serializer for Traversables types.
Serializer for Traversables types.
(Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.JodaDateNumberWrites
(Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.DefaultJodaLocalDateWrites
(Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.DefaultJodaLocalTimeWrites
(Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.jodaDateWrites
(Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.jodaLocalDateWrites
(Since version 2.6.0) Include play-json-joda as a dependency and use JodaWrites.jodaLocalTimeWrites
Default Serializers.