It depends on the framework you use to convert json. Different frameworks have different processing methods. It is recommended to read the documentation
1. Use the built-in methods of the JSON framework, such as the @JsonIgnore annotation provided by Jackson.
2. Follow JsonIgnore and customize an annotation. During the conversion process, it is judged and processed through JAVA reflection and Annotated related classes. This method has strong customization ability. For example, all null values can be not converted. Or convert the date attribute into different formats.
3. Customize an intermediate class that only contains the attributes that need to be converted, then assign the data object to the intermediate class object, and finally convert the intermediate class object, so that the attributes that are not included will not appear.
I don’t know where it is stored. If you need to serialize it, you can use thetransientkeyword.
Among them, passwd is always null
Try adding @JsonIgnore to the attribute to ignore it
It depends on the framework you use to convert json. Different frameworks have different processing methods. It is recommended to read the documentation
1. Use the built-in methods of the JSON framework, such as the @JsonIgnore annotation provided by Jackson.
2. Follow JsonIgnore and customize an annotation. During the conversion process, it is judged and processed through JAVA reflection and Annotated related classes. This method has strong customization ability. For example, all null values can be not converted. Or convert the date attribute into different formats.
3. Customize an intermediate class that only contains the attributes that need to be converted, then assign the data object to the intermediate class object, and finally convert the intermediate class object, so that the attributes that are not included will not appear.