json-view icon indicating copy to clipboard operation
json-view copied to clipboard

Why JsonView ignore @JsonInclude annotation?

Open TheNullablePrototype opened this issue 2 years ago • 0 comments

@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("*"))

TheNullablePrototype avatar May 05 '23 08:05 TheNullablePrototype