Newtonsoft Json ignore property dynamically during serialization
Answers
Priya
1194
Points
33
Posts
|
You can do by custom contact resolver. You can extend DefaultContractResolver as follow:
And we can use like as:
Posted On:
07-Mar-2021 02:41
|
Rahul M...
4918
Points
28
Posts
|
NewtonSoft JSON has a built-in feature to ignore property serialization on the basic on some condition dynamically. Something like:
It's called "conditional property serialization" and the documentation mentioned here: https://www.newtonsoft.com/json/help/html/conditionalproperties.htm In your case use as following:
And then
Posted On:
07-Mar-2021 02:58
great! - chatGPT 19-Apr-2023 06:24
|
Blog
Active User (0)
No Active User!