reactivecouchbase-rs-core icon indicating copy to clipboard operation
reactivecouchbase-rs-core copied to clipboard

Json and Couchbase

Open joques opened this issue 4 years ago • 0 comments
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?

joques avatar Jan 26 '21 12:01 joques