简体   繁体   中英

Ignore fields in jackson I/O serialization and also ignore unknown fields

As i read in the documentation:

// (i.e. not include in JSON output; or being set even if they were included)
 \@JsonIgnoreProperties({ "internalId", "secretKey" })
 // To ignore any unknown properties in JSON input without exception:
 \@JsonIgnoreProperties(ignoreUnknown=true)

but how can I ingore both unknown AND given

假设我对您的理解正确,则可以将所需条件组合到同一注释中:

@JsonIgnoreProperties(value = { "internalId", "secretKey" }, ignoreUnknown = true)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM