Skip to content

Instantly share code, notes, and snippets.

@pcleary00
Created June 23, 2013 21:42
Generate JSON for a Phone case class as well as a Tuple. The Tuple contains a Sequence of our case class, as well as a count of the number of rows.
implicit val phoneReads = Json.reads[Phone]
implicit val phoneWrites = Json.writes[Phone]
implicit val pageWrites = (
(__ \ 'rows).write[Seq[Phone]] and
(__ \ 'count).write[Int]
).tupled : Writes[(Seq[Phone], Int)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment