Created
November 19, 2014 07:48
-
-
Save d6y/01cb6e58d63535cdde4e to your computer and use it in GitHub Desktop.
Notify example
This file contains hidden or 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
| import play.api.libs.json._ | |
| case class Notify(email: Option[String] = None) | |
| implicit val reader = Json.reads[Notify] | |
| Json.parse(""" { "email": "[email protected]" } """).asOpt[Notify] | |
| // res0: Option[Notify] = Some(Notify(Some([email protected]))) | |
| Json.parse(""" { } """).asOpt[Notify] | |
| // res1: Option[Notify] = Some(Notify(None)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment