How to convert case class to JSON in Play framework 2.3.x (Scala)?
You can get an Writes[Foo]
instance by using Json.writes
:
implicit val fooWrites = Json.writes[Foo]
Having this implicit in scope is all you need to convert Foo
to JSON. See the documetnation here and here for more info about JSON reads/writes.