in pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/JsonFormats.scala [24:32]
override def read(json: JsValue): T = json match {
case JsString(text) =>
stringToValue.get(text.toLowerCase) match {
case Some(t) => t
case None => deserializationError(s"Possible values are ${stringToValue.keySet}, [$text] is not among them")
}
case surprise =>
deserializationError(s"Expected a string value, got $surprise")
}