Created
May 2, 2016 21:01
-
-
Save ryanpbrewster/7f3c1e9dec34808a34889345ab61e451 to your computer and use it in GitHub Desktop.
Writes[Person] for Working with JSON in Play 2.1 by Greg Methvin
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
import play.api.libs.json._ | |
implicit val personFormat = Json.format[Person] | |
Json.toJson(Person(Some(1), "Arthur", "Dent", "[email protected]", new LocalDate("1952-03-11"))) | |
// => {"id":1,"firstName":"Arthur","lastName":"Dent",birthDate":"1952-03-11"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment