How to throw an exception when JsonConstructor parameter name doesn't match JSON?
问题 I'm deserializing a bunch of C# readonly structures (which have their constructors marked by [JsonConstructor] ), and I'm trying to fail early if any JSON that I receive is malformed. Unfortunately, if there is a naming discrepancy between the constructor parameter and the input JSON, the parameter just gets assigned a default value. Is there a way that I could get an exception instead, so these defaults don't accidentally "pollute" the rest of my business logic? I have tried playing with