Jackson JSON – Ignore Properties with @JsonIgnore and @JsonIgnoreProperties

In this tutorial, we’re gonna look at ways to ignore Properties of a Class using @JsonIgnore and @JsonIgnoreProperties.

I. Maven Dependency

II. @JsonIgnore

Use @JsonIgnore on fields or getters or setters to ignore individual properties:
Customer class:

App class for testing:

>> Result:

III. @JsonIgnoreProperties

Use @JsonIgnoreProperties to ignore multiple properties with just one declaration:
Customer class:

App class for testing:

>> Result:

By JavaSampleApproach | February 3, 2018.

Related Posts


Got Something To Say:

Your email address will not be published. Required fields are marked *

*