Skip to content

Instantly share code, notes, and snippets.

@d6y
Created November 19, 2014 07:48
Show Gist options
  • Select an option

  • Save d6y/01cb6e58d63535cdde4e to your computer and use it in GitHub Desktop.

Select an option

Save d6y/01cb6e58d63535cdde4e to your computer and use it in GitHub Desktop.
Notify example
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