I have a Person case class:
case class Person(name: String, createdAt: LocalDateTime)
to be able to serialize person object to json so I can return it to the user I have a serualizer:
object PersonSerializer {
implicit val PersonFormat: OFormat[Person] = Json.format[Person]
}
and I import this serializer in the controller so when I can return the result to the use as json like this:
def getPeople: Action[AnyContent] = Action.async {
peopleDao.getAllPeople.map(people => Ok(Json.toJson(res)))
}
BUT, I get this error:
Error:(39, 55) No instance of play.api.libs.json.Format is available for org.joda.time.LocalDateTime in the implicit scope (Hint: if declared in the same file, make sure it's declared before) implicit val AFormat: OFormat[Account] = Json.format[Account]
How can I fix this?