Skip to content

Why JsonView ignore @JsonInclude annotation? #89

@TheNullablePrototype

Description

@TheNullablePrototype
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class OrderDTO {

    @JsonProperty("id")
    Integer id;
    
    @JsonProperty("code")
    String code;
    
    @JsonProperty("number")
    String number;

    @JsonProperty("name")
    String name;

    @JsonProperty("statusId")
    Integer statusId;

    @JsonProperty("date")
    Instant date;

    @JsonProperty("files")
    List<FileEntityDTO> files;

}

Response:

        {
            "id": 6,
            "code": "code",
            "number": null,
            "name": "Name",
            "statusId": 1,
            "date": null,
            "files": []
        }

use:

JsonView.with(orders).onClass(OrderDTO.class, Match.match().include("*"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions