@JsonInclude(Include.NON_NULL)
class XXXXX{
........
}
设置dto中null字段自动过滤
class XXX{
@JsonProperty("XXX") dto转化json后字段自动命名XXX
private String XXX
}
本文介绍了一种在Java中使用@JsonInclude注解自动过滤DTO中null字段的方法,并展示了如何通过@JsonProperty注解自定义字段名来优化JSON序列化过程。
@JsonInclude(Include.NON_NULL)
class XXXXX{
........
}
设置dto中null字段自动过滤
class XXX{
@JsonProperty("XXX") dto转化json后字段自动命名XXX
private String XXX
}
1745
5562

被折叠的 条评论
为什么被折叠?
