Wences Llobet
Wences Llobet

Reputation: 585

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

Upvotes: 1

Views: 814

Answers (1)

JamesB
JamesB

Reputation: 7894

Assuming I have understood you correctly, you can combine the conditions you want into the same annotation:

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

Upvotes: 4

Related Questions