Java entity class bean conversion Json string filter null value

In the development process, it is often necessary to convert the entity class object into a Json string. If it is directly stored as a value in the library, it will be found that the uncopied properties are displayed as null. Here you need to filter out the attribute values ​​that are not copied, and only display the attributes with values.

The packages and annotations introduced by the following entity classes only need one line of annotations.

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)

legend
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_23140197/article/details/105390847