1

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

http://pastebin.com/hG8F6Gqk

3 Answers 3

2

Well, turned out the problem was obvious. I forgot to import play.api.libs.functional.syntax._.

Sign up to request clarification or add additional context in comments.

Comments

1
import play.api.libs.json._
import play.api.libs.functional.syntax._

Comments

-1

The underscore you're using isn't a standard underscore.

Your underscore: __

ASCII Character #95: _

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.