No Json serializer as JsObject found for type play.api.libs.json.JsObject
The final release of ReactiveMongo 0.11 has been published ("org.reactivemongo" %% "play2-reactivemongo" % "0.11.0.play23"
).
As indicated on the updated documentation, for the default BSON/JSON conversions, it's recommended to have: import play.modules.reactivemongo.json._, ImplicitBSONHandlers._
.
In my case, I was feeding ReactiveMongo (insert
) with a JsValue
instead than a JsObject
. In order to fix it, behind adding import play.modules.reactivemongo.json._
, I also had to change my implicit Writes
in OWrites
:
from
implicit val myWrites: Writes[A] = new Writes[A] {
def writes(a: A) = Json.obj(...)
to
implicit val myWrites: OWrites[A] = new OWrites[A] { <-- NOTE THE 'O' before 'Writes'
def writes(a: A) = Json.obj(...)
Mine worked out after adding: import play.modules.reactivemongo.json._ import play.modules.reactivemongo.json.collection._