Workaround for providing support for EnumMemberAttribute #80858
Replies: 2 comments
-
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsWe are migrating our code base from Newtonsoft to System.Text.Json. Based on this post, I see that the support for this attribute is not provided in System.Text.Json out of the box : #74385 (comment) I there any workaround we can implement to provide this support?
|
Beta Was this translation helpful? Give feedback.
-
That attribute isn't part of JSON serialization. That's for ASP.Net data contracts. You can use |
Beta Was this translation helpful? Give feedback.
-
We are migrating our code base from Newtonsoft to System.Text.Json.
Our data model uses the EnumMemberAttribute decorations https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.enummemberattribute?view=net-7.0.
Based on this post, I see that the support for this attribute is not provided in System.Text.Json out of the box : #74385 (comment)
The post mentions that we can implement custom converters to provide support for this - but its unclear to me how this can be done.
Can you please provide a sample implementation of such a custom converter?
Beta Was this translation helpful? Give feedback.
All reactions