PlayFramework in Scala, Reading - Error in case of unknown key?
I have a custom one Reads
for my object:
implicit val myReads: Reads[MyObject] = (
(__ \ "id").readNullable[UUID] and
(__ \ "name").readNullable[String]
)(MyObject.apply _)
Can I crash if an unknown key is provided? For example, I would like it to fail when trying to parse a Json like this,
{ "key" : 1234 }
so that request.body.validate[MyObject]
will result in a JsError
. Thank!
+3
source to share
No one has answered this question yet
See similar questions:
or similar: