reactivecouchbase-rs-core
reactivecouchbase-rs-core copied to clipboard
Json and Couchbase
trafficstars
Hi all,
where can I find examples regarding JsonReads and JsonWrites for "complex" complex objects? Say I have a user-defined as follows:
User { firstName: "Some name", lastName: "Some other name", age: 25 }
When I follow the example in the Json library and create JsonReads as follows:
val userJsonReads: JsonReads[User] = JsonReads(JsonReads(bs => JsonSuccess(Json.parse(bs.utf8String))) the compiler complains about type mismatch. It obviously finds JsValue instead of User. Do I need a converter? Any example?
What about JsonWrites?
Btw, is there any way to reuse Json.reads and Json.writes from play.api.libs.json?