Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json and Couchbase #31

Open
joques opened this issue Jan 26, 2021 · 0 comments
Open

Json and Couchbase #31

joques opened this issue Jan 26, 2021 · 0 comments

Comments

@joques
Copy link

joques commented Jan 26, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant