I have a case class like
case class Person(firstName: String, lastName: String)
I'd like to pretty-print it as JSON. I am working within Play Framework 2.1.x. I also happen to have the Salat library in my classpath, so I could use that as well. I'd like to see what all the options are however including json4s, etc.
JSON libraries in Scala have been evolving rapidly. I believe this can be done with a few lines of code for all case classes (i.e. without requiring additional code for each case class) using macros and such.
I believe I can use play's built-in macro-based Json library, but I'd like to see some worked-out examples. I'm aware of a few starting points:
http://eng.42go.com/working-with-json-in-play-2-1/
https://github.com/novus/salat/wiki/JSON
Scala 2.10, its impact on JSON libraries and case class validation/creation
But I'd like to see examples using json4s and such as well.