This code doesn't handle empty string values well:
val getPerson = (json \ "ID").asOpt[String].map(id => List(Person(name, id, birthday))).getOrElse(List.empty)
Problem is that ID can be an empty string, Person's constructor allows id to be empty (by design) but I don't want Persons with no ID at this stage.
I tried:
val getPerson = (json \ "ID").asOpt[String].map(id => if (id.nonEmpty) List(Person(name, id, birthday))).getOrElse(List.empty)
but then the return type is Any instead of List[Person]
My goal is in cases of an empty id return List.empty