简体   繁体   English

忽略杰克逊I / O序列化中的字段,也忽略未知字段

[英]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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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