The reads format converts a play.api.libs.json.JsValue to an object. Reads
is expecting a json value that looks like this:
import play.api.libs.json.{Json, JsValue}
val js: JsValue = Json.obj(
"_id" -> "5259c384dd8251bb085adfb4",
"title" -> "Shrikar",
"text" -> "test",
"cash" -> 12.0,
"created_at" -> 1381614468235,
"updated_at" -> 1381614468235
)
You should start by taking a look at the Playframework working with JSON documentation. If you are using a library such as ReactiveMongo, then mongodb queries should return a BSONDocument or JsValue. According to the Reactive Mongo docs:
With Play2-ReactiveMongo, you can use directly the embedded JSON library in Play >= 2.1. There is a specialized collection called JSONCollection that deals naturally with JSValue and JSObject instead of ReactiveMongo's BSONDocument.
If you can only receive mongodb query results as String, then you'll need to create a function to parse it into a JsValue.
I hope this helps!