json-view
json-view copied to clipboard
Why JsonView ignore @JsonInclude annotation?
@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("*"))