Jackson ignores private fields
this way the field i is completely ignored, can i somehow include it?
tried
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
but that did not work9 Replies
⌛
This post has been reserved for your question.
Hey @Koblížkáč! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Why do you want to make it visible after explicitly ignoring it?
Do you just not want jackson to call the getter?
yea
the getter returns the value, but modified
i want the serialized value to not be modified
I think you can configure it to use field access without
@JsonIgnore
Stack Overflow
How to specify jackson to only use fields - preferably globally
Default jackon behaviour seems to use both properties (getters and setters) and fields to serialize and deserialize to json.
I would like to use the fields as the canonical source of serialization
set the field visibility to any and the getter visibility to none
also with
@JsonAutoDetect
Also, smarter approach: use a DTO, without a getter that modifies the value
also that
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.