Default Serializers.
Attributes
- Companion
- trait
- Graph
-
- Supertypes
-
trait GeneratedWritestrait DefaultWritestrait LowPriorityWritestrait EnvWritestrait ConstraintWritestrait PathWritesclass Objecttrait Matchableclass AnyShow all
- Self type
-
Writes.type
Members list
Type members
Inherited classlikes
Serializer for BigDecimal types.
Serializer for BigInt type.
Serializer for BigInteger type.
Serializer for Boolean types.
Serializer for Byte types.
Serializer for Double types.
Serializer for Float types.
Serializer for Int types.
Serializer for Long types.
Serializer for Short types.
Serializer for String types.
Formatting companion
Formatting companion
Attributes
- Inherited from:
- EnvWrites
- Supertypes
-
class Objecttrait Matchableclass Any
Typeclass to implement way of formatting of Java8 temporal types.
Typeclass to implement way of formatting of Java8 temporal types.
Attributes
- Inherited from:
- EnvWrites
- Supertypes
-
class Objecttrait Matchableclass Any
Serializer for java.util.UUID
Deprecated and Inherited classlikes
Attributes
- Deprecated
- true
- Inherited from:
- DefaultWrites
- Supertypes
Attributes
- Deprecated
- true
- Inherited from:
- DefaultWrites
- Supertypes
Value members
Concrete methods
Returns an instance which uses f
as Writes.writes function.
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)) }
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)) }
Value parameters
- f
-
the transformer function
- w
-
the initial writer
Attributes
Inherited methods
Attributes
- Inherited from:
- PathWrites
Serializer for java.util.Date
Serializer for java.util.Date
Value parameters
- pattern
-
the pattern used by SimpleDateFormat
Attributes
- Inherited from:
- DefaultWrites
Attributes
- Inherited from:
- PathWrites
Attributes
- Inherited from:
- PathWrites
Attributes
- Inherited from:
- PathWrites
Attributes
- Inherited from:
- ConstraintWrites
Attributes
- Inherited from:
- ConstraintWrites
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]
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]
Attributes
- Inherited from:
- PathWrites
Attributes
- Inherited from:
- ConstraintWrites
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
Attributes
- Inherited from:
- ConstraintWrites
Attributes
- Inherited from:
- ConstraintWrites
Attributes
- Inherited from:
- ConstraintWrites
Attributes
- Inherited from:
- PathWrites
Attributes
- Inherited from:
- ConstraintWrites
Attributes
- Inherited from:
- ConstraintWrites
Serializer for Java8 temporal types (e.g. java.time.LocalDateTime
) to be written as JSON string.
Serializer for Java8 temporal types (e.g. java.time.LocalDateTime
) to be written as JSON string.
Type parameters
- A
-
the Java8 temporal type to be considered: LocalDateTime, ZonedDateTime, Instant
- B
-
Type of formatting argument
Value parameters
- 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)
Attributes
- Inherited from:
- EnvWrites
Deprecated and Inherited methods
Serializer for Iterable types.
Serializer for Iterable types.
Deprecated due to incompatibility with non _[_]
shapes, #368.
Attributes
- Deprecated
- true
- Inherited from:
- LowPriorityWrites
Attributes
- Deprecated
- true
- Inherited from:
- ConstraintWrites
Serializer for java.sql.Date
Serializer for java.sql.Date
Value parameters
- pattern
-
the pattern used by SimpleDateFormat
Attributes
- Deprecated
- true
- Inherited from:
- DefaultWrites
Attributes
- Deprecated
- true
- Inherited from:
- LowPriorityWrites
Inherited fields
Serializer for java.time.Instant
as JSON number. The number of milliseconds since epoch is used.
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
Attributes
- Inherited from:
- EnvWrites
Serializer for java.time.LocalDate
as JSON number. The number of milliseconds since epoch is used.
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
Attributes
- Inherited from:
- EnvWrites
Serializer for java.time.LocalDateTime
as JSON number. The number of milliseconds since epoch is used.
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
Attributes
- Inherited from:
- EnvWrites
Serializer for java.time.LocalTime
as JSON number. The nano of day is written.
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
Attributes
- Inherited from:
- EnvWrites
Serializer for java.time.ZonedDateTime
as JSON number. The number of milliseconds since epoch is used.
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
Attributes
- Inherited from:
- EnvWrites
Serializer of Java Duration as a number of milliseconds.
Serializer for a Locale
using a object representation
Givens
Inherited givens
Serializer for scala.Enumeration by name.
Serializer for scala.Enumeration by name.
Attributes
- Inherited from:
- EnumerationWrites (hidden)
Implicits
Implicits
Inherited implicits
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.
Attributes
- Inherited from:
- EnvWrites
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.
Attributes
- Inherited from:
- EnvWrites
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.
Attributes
- Inherited from:
- EnvWrites
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.
Attributes
- Inherited from:
- EnvWrites
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.
Attributes
- Inherited from:
- EnvWrites
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.
Attributes
- Inherited from:
- EnvWrites
Serializer for JsNull.
Serializer for JsNull.
import play.api.libs.json.Json
Json.obj("foo" -> None)
// equivalent to Json.obj("foo" -> JsNull)
Attributes
- Inherited from:
- DefaultWrites
Serializer for Option.
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Attributes
- Inherited from:
- GeneratedWrites
Serializer for java.time.ZoneId
as JSON string.
Serializer for Array[T] types.
Default Serializer java.util.Date -> JsNumber(d.getTime (nb of ms))
Default Serializer java.util.Date -> JsNumber(d.getTime (nb of ms))
Attributes
- Inherited from:
- DefaultWrites
Serializer for Map[String,V] types.
Serializer for Iterable types.
Serializer of Java Duration using ISO representation (e.g. PT1S for 1 second).
Serializer of Java Duration using ISO representation (e.g. PT1S for 1 second).
Attributes
- Inherited from:
- EnvWrites
Serializer of Java Period using ISO representation (e.g. P2D for 2 days).
Serializer of Java Period using ISO representation (e.g. P2D for 2 days).
Attributes
- Inherited from:
- EnvWrites
Serializer for JsValues.
Serializer for Jackson JsonNode
Attributes
- Inherited from:
- DefaultWrites
Serializer for a Locale
using the IETF BCP 47 string representation
Serializer for a Locale
using the IETF BCP 47 string representation
Attributes
- Inherited from:
- EnvWrites
Serializer for scala.collection.immutable.Range (aka specialized Seq
of Int
).
Serializer for scala.collection.immutable.Range (aka specialized Seq
of Int
).
Attributes
- Inherited from:
- DefaultWrites
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)
Attributes
- Inherited from:
- DefaultWrites
Serializer for any type that is provided an implicit conversion to String (e.g. tagged types).
Serializer for any type that is provided an implicit conversion to String (e.g. tagged types).
Attributes
- Inherited from:
- LowPriorityWrites
Serializer for java.net.URI
Deprecated and Inherited implicits
Serializer for Map[String,V] types.