Last active
December 31, 2018 11:10
-
-
Save hoangong/a1b05aae660bdd734074 to your computer and use it in GitHub Desktop.
Play2 Json object serialization #play #scala #serialisation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val accessTokenReads = ( | |
(__ \ "token").read[String] and | |
(__ \ "createdDate").read[LocalDateTime] and | |
(__ \ "expiredDate").read[LocalDateTime] and | |
(__ \ "expired").read[Boolean] | |
) (AccessToken.apply _) | |
val accessTokenWrites = ( | |
(__ \ "token").write[String] and | |
(__ \ "createdDate").write[LocalDateTime] and | |
(__ \ "expiredDate").write[LocalDateTime] and | |
(__ \ "expired").write[Boolean] | |
) (unlift(AccessToken.unapply)) | |
implicit val accessTokenFormat: Format[AccessToken] = Format(accessTokenReads, accessTokenWrites) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment