ObjectMapper序列化json,不包含null值属性

2024-10-17 08:02:37

1、新建一个User实体类,生成get set方法

ObjectMapper序列化json,不包含null值属性

3、右键点击【Run】,启动程序

ObjectMapper序列化json,不包含null值属性

5、设置objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);

ObjectMapper序列化json,不包含null值属性
猜你喜欢