How do I replace a value in a JSON value in Play? Code to illustrate:
def newReport() = Action(parse.json) { request => var json = request.bod
Something along the lines of:
val updatedJson = if((request.body \ "customerId").as[Int] == -1){ val newId = JsObject(Seq(("customerId",JsString("ID12345")))) (request.body ++ newId).as[JsValue] } else request.body updatedJson.validate[Report](Reports.readsWithoutUser).map { case _: Report =>