You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey all,
I was playing around with JsonSerializerOptions and I noticed that collections are being ignored by the property JsonSerializerOptions.IgnoreReadOnlyProperties.
It continues serializing the properties.
What this does is that we need to bring an unecessary dependency to our models (JsonIgnoreAttribute) which, for me, makes no sense.
And the alternative of creating custom json converters is quite painfull.
Noticed that an issue was already created/closed without a clear answer to it.
System.Text.Json: JsonSerializerOptions.IgnoreReadOnlyProperties being ignored #37599
What this does is that we need to bring an unecessary dependency to our models (JsonIgnoreAttribute) which, for me, makes no sense.
Agreed, but at this point changing the behavior would likely be a breaking change. The functionality in #63686 should provide a configuration mechanism alternative to applying JsonIgnore attributes.
Activity
eiriktsarpalis commentedon Apr 4, 2022
Agreed, but at this point changing the behavior would likely be a breaking change. The functionality in #63686 should provide a configuration mechanism alternative to applying JsonIgnore attributes.