package util
- Alphabetic
- Public
- All
Type Members
- trait JsonImplicits extends AnyRef
- class OReadsOps[A] extends AnyRef
-
class
OWritesOps[A] extends AnyRef
Alter operations available on Play-JSON Reads[T] & Writes[T]
Alter operations available on Play-JSON Reads[T] & Writes[T]
Inspired by http://kailuowang.blogspot.co.nz/2013/11/addremove-fields-to-plays-default-case.html
Created by apatzer on 3/17/17.
- trait RobustPrimitives extends AnyRef
Value Members
- object JsonImplicits extends JsonImplicits
- object JsonNaming
- object OReadsOps
- object OWritesOps
-
object
RobustParsing
We may fail to parse certain fields of a redox Json message to our domain object.
We may fail to parse certain fields of a redox Json message to our domain object. However, we still need to extract useful fields from the message to continue processing, Robust parsing will recursively parse and then remove any invalid fields until a result can be obtained.
First we try to parse the passed in Json object, if there are any errors we trim the heads of the paths containing the errors and try to parse again. This allows us to assign defaults to any fields that cannot be parsed if they are defined and try to get a valid result.
This returns a tuple of (maybeErrors, maybeResult) so nessorory action can be taken downstream about and recovered errors. ie: Logging recovery errors to fix if needed.