How to conditionally serialize some variables of a class in C# using system.text.json
How can I conditionally serialize some variables of a class in C# using system.text.json.
Earlier I was using shouldserialize keyword in newtonsoft json. But now i am supposed to move everything to text.json.