I have the following class:
@JsonIgnoreProperties(ignoreUnknown = true)
public class Topic {
private List<Comment> comments = new ArrayList<>();
private List<User> users = new ArrayList<>();
@JsonCreator
public Topic(@JsonProperty("success") boolean success,
@JsonProperty("response_comments") List<ResponseComment> responseComments,
@JsonProperty("response_users") List<ResponseUser> responseUsers) {
if (success) {
comments = Util.resolveComments(responseComments);
users = Util.resolveUsers(responseUsers); //some logic
}
}
}
When I try to deserialize JSON, it throws:
Could not find creator property with name 'comments' (in class com.test.domain.mapper.Topic)
I don't want to fill comments
from json, just in constructor from properties. However, if I write next params:
@JsonProperty("success") boolean success,
@JsonProperty("response_comments") List<ResponseComment> responseComments,
@JsonProperty("response_users") List<ResponseUser> responseUsers,
@JsonProperty("comments") Object a,
@JsonProperty("users") Object a
all works.
comments
andusers
comments
andusers
with@JsonIgnore