-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[Bug] CreateProperties adds JsonIgnore fields when it should not MemberSerialization.OptOut #2968
Comments
There is no bug here. First,
serializer will not generate an output like
Yes, and it does exactly that already. The
If you look at the
That's an incorrect expectation. You serialize a (P.S.: I am not associated or related to the Newtonsoft.Json project and its author/maintainer. I am just a fellow user of the library... or perhaps former user, as these days it's pretty much always STJ over Newtonsoft.Json.) |
@elgonzo as mentioned in my initial entry there is no json example. The {""} is me implying that with the text above it. If that is what you got hung up on then ignore {""} as that means nothing to me or anyone else. [JsonIgnore] does not function as intended. public class SomeClass {
[JsonIgnore]
public string activeProject = string.Empty;
} To: public class SomeClass {
[JsonIgnore]
private string activeProject = string.Empty;
} It won't show. Same with: public class SomeClass {
private string activeProject = string.Empty;
} |
Source/destination types
Source/destination JSON
No example required. Should not create a json file.
Expected behavior
When
[JsonIgnore]
is used on a public field it should be ignored per OptOut.Actual behavior
Class members with the custom attribute tag
[JsonIgnore]
are shown in theIList<JsonProperty>
when called by the methodCreateProperties(Type type, MemberSerialization memberSerialization)
.Steps to reproduce
Follow the code all the way to
and MemberSerialization is set to MemberSerialization.OptOut
The text was updated successfully, but these errors were encountered: