-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add new JsonIgnoreAttribute WhenWriting/WhenReading #104562
base: main
Are you sure you want to change the base?
Conversation
Note regarding the
|
1 similar comment
Note regarding the
|
/// <summary> | ||
/// Property is ignored during deserialization | ||
/// </summary> | ||
WhenReading = 5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eiriktsarpalis, how does someone specify multiple of these? e.g. if I have a property that I want to be ignored when reading and when writing null, how do I achieve that? Or is that not a scenario that matters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not possible, which shows the limits of the JsonIgnoreCondition
design. These enums eventually map to the JsonPropertyInfo.ShouldSerialize
and JsonPropertyInfo.Set
delegates, so a user wanting to introduce their own ignore conditions can configure these via the contract customization APIs.
4ac298c
to
c92014b
Compare
c92014b
to
80b411a
Compare
9b27aba
to
58a0eb7
Compare
58a0eb7
to
5ec8c18
Compare
@WeihanLi thanks for submitting the PR, however since we're currently in the process of finishing up .NET 9 we are no longer merging PRs adding new features. We can revisit this in a couple weeks' time once the .NET 9 branch has been snapped from main. |
Apologies for the delay getting back to you, we can continue work on this PR for .NET 10 now. |
feat: add new JsonIgnoreAttribute WhenWriting/WhenReading
fixes #66490