Creates a new Reads
, which first passes the input JSON to rb
,
and then it executes this Reads
on the pre-processed JSON
(if rb
has successfully handled the input JSON).
Creates a new Reads
, which first passes the input JSON to rb
,
and then it executes this Reads
on the pre-processed JSON
(if rb
has successfully handled the input JSON).
Returns a new instance that first converts a B
value to a A
one,
before converting this A
value into a JsValue.
Create a new Reads
which maps the value produced by this Reads
.
Create a new Reads
which maps the value produced by this Reads
.
The type of the value produced by the new Reads
.
the function applied on the result of the current instance, if successful
Creates a new Reads
, based on this one, which first executes this
Reads
' logic then, if this Reads
resulted in a JsError
, runs
the second Reads
on the JsValue.
Creates a new Reads
, which first transforms the input JSON
using the given tranformer
, and then it executes this Reads
on the pre-processed JSON.
Creates a new Reads
, which first transforms the input JSON
using the given tranformer
, and then it executes this Reads
on the pre-processed JSON.
Transforms the resulting JsValue using a Writes[JsValue]
.
Transforms the resulting JsValue using transformer function.
Widen this Reads
.
Widen this Reads
.
import play.api.libs.json.Reads def simple(r: Reads[Dog]): Reads[Animal] = r.widen[Animal] def combine(dog: Reads[Dog], cat: Reads[Cat]): Reads[Animal] = dog.orElse(cat).orElse(Reads.failed[Animal]("Unsupported Animal"))
(Since version 2.7.0) Use composeWith
Json formatter: write an implicit to define both a serializer and a deserializer for any type.