In Play Framework 2.6.x, Joda DateTime Format (that is READs and WRITEs) is not working. When we use something like below:
(JsPath \ "joiningDate").read[LocalDate]
We will see the following error message:
No Json deserializer found for type org.joda.time.LocalDate. Try to implement an implicit Reads or Format for this type.
To fix that issue, we need to do the following two setps:
1. Add the following entry into your build.sbt file
libraryDependencies += "com.typesafe.play" % "play-json-joda_2.12" % "2.6.6"
Or
scalaVersion := "2.12.2"
libraryDependencies += "com.typesafe.play" %% "play-json-joda" % "2.6.6"
2. Add the following imports to your Model file
import play.api.libs.json.JodaWrites._
import play.api.libs.json.JodaReads._
Description:
They have separated the Joda Date and Time library into a separate module:
play-json-joda
That's it.
Thank you for reading my tutorials.
(JsPath \ "joiningDate").read[LocalDate]
We will see the following error message:
No Json deserializer found for type org.joda.time.LocalDate. Try to implement an implicit Reads or Format for this type.
To fix that issue, we need to do the following two setps:
1. Add the following entry into your build.sbt file
libraryDependencies += "com.typesafe.play" % "play-json-joda_2.12" % "2.6.6"
Or
scalaVersion := "2.12.2"
libraryDependencies += "com.typesafe.play" %% "play-json-joda" % "2.6.6"
2. Add the following imports to your Model file
import play.api.libs.json.JodaWrites._
import play.api.libs.json.JodaReads._
Description:
They have separated the Joda Date and Time library into a separate module:
play-json-joda
That's it.
Thank you for reading my tutorials.
No comments:
Post a Comment