Trying to migrate my code to play 2.6 Everything is fine except the Format for DateTime type.
As part of the migration I did add the play-json-joda
as dependency.
However, something like this:
case class GeoArea(id: Option[Int] = None,
continentId: Option[Int] = None,
countryId: Option[Int] = None,
code: String,
name: String,
discr: Discriminator.Value,
createdAt: DateTime = DateTime.now,
updatedAt: DateTime = DateTime.now,
deletedAt: Option[DateTime] = None,
createdBy: Option[String] = None,
updatedBy: Option[String] = None)
With format object defined as:
implicit lazy val geoAreaFormat: Format[GeoArea] = Json.format[GeoArea]
I am getting an error:
No instance of play.api.libs.json.Format is available for org.joda.time.DateTime, org.joda.time.DateTime, scala.Option[org.joda.time.DateTime] in the implicit scope (Hint: if declared in the same file, make sure it's declared before) [error]
implicit lazy val geoAreaFormat: Format[GeoArea] = Json.format[GeoArea]
What am I missing? What else do I need to have in scope to resolve that?
My imports look like this:
import driver.PGDriver.api._
import org.joda.time.DateTime
import play.api.libs.json._
import slick.lifted.Tag
import model.GeoAreas.Discriminator
import converters.{JsonEnumeration, SlickEnumeration}
And they didn't change as during the migration, but these ones were enough for everything to work.