Skip to content

include @JsonbGraph to (de)serialize subset of Json-B entity #176

Open
@nimo23

Description

@nimo23

Would be nice to have filter/query cabapilities to (de)serialize only a subset of the Json-B entity per config.

For example:

// (de)serialize only "id", tasks and their name
@JsonbGraph(name= "ItemWithTasks" value = {"id", "tasks", "tasks.name"})
public class Item {

    private int id;
    private String description;
    private Set<Task> tasks;
}

and use it like:

var item = new Item(..);
var toJson = JsonbBuilder.create().withGraph("ItemWithTasks").toJson(item);
var fromJson = JsonbBuilder.create().withGraph("ItemWithTasks").fromJson(toJson)

The @JsonbGraph can provide capabilities like GraphQL or JPA FetchGraph.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions