Skip to content

Json and Couchbase #31

Description

@joques

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions