How to turn json to case class when case class has only one field

As Julien answered, you can read single field case classes using this: case class Person(name: String) val personReads: Reads[Person] = (__ \ “name”).read[String].map { name => Person(name) } Just a complement, if you want to write: val personWrites: Writes[Person] = (__ \ “name”).write[String].contramap { (person: Person) => person.name } Or format (read and write): val … Read more

Build.scala, % and %% symbols meaning

From the official documentation: http://www.playframework.com/documentation/2.1.1/SBTDependencies Getting the right Scala version with %% If you use groupID %% artifactID % revision instead of groupID % artifactID % revision (the difference is the double %% after the groupID), SBT will add your project’s Scala version to the artifact name. This is just a shortcut. You could write … Read more