While working on a project, I made the mistake of putting a @JsonIgnore on the setter rather than the getter property as below
private Set<Book> books;
public Set<Book> getBooks() {
return books;
}
@JsonIgnore
public void setBooks(Set<Book> books) {
this.books = books;
}
This should have resulted in my getbooks api call working fine (calling from postman). However, i realise that @JsonIgnore prevents serialisation even if the @JsonIgnore is set on the setter.
Is this how normally @JsonIgnore works ? I thought setting @JsonIgnore only on the getter prevents serialisation. Here it is preventing serialisation even if i put it on the getter or the setter.
Any advice appreciated. Thanks.
@JsonIgnore- Rajith Pemabandu