Reputation: 30125
Could you please demostrate how I can define json writer for my class in Scala and Play Framework 2.1-RC2 ?
The documentation is quite confusing (and will be significant obstacle for wider adoption of Scala/Play by web-developer community). For example not only it's unclear where exactly following code (taken from here) should be located
implicit val taskWrites = (
(__ \ "id").write[String] ~
(__ \ "label").write[Boolean] ~
)(unlift(Task.unapply))
but it's also not compilable if I put it inside object
definition. Play gives me following error
not found: value __
Here is my Task.scala
Upvotes: 1
Views: 1194
Reputation: 22041
import play.api.libs.json._
import play.api.libs.functional.syntax._
Upvotes: 1
Reputation: 30125
Well, turned out the problem was obvious. I forgot to import play.api.libs.functional.syntax._
.
Upvotes: 2
Reputation: 7247
The underscore you're using isn't a standard underscore.
Your underscore: __
ASCII Character #95: _
Upvotes: -1