I have a class I want to deserialize into using Json.NET
:
public class Settings {
public MoreSettings More { get; set; }
}
public class MoreSettings {
public int Value { get; set; }
}
I want the following examples without unknown properties to successfully deserialize.
1.1
{}
1.2
{
"MoreSettings": null
}
1.3
{
"MoreSettings": {
}
}
1.4
{
"MoreSettings": {
"Value": 42
}
}
I want the following examples with unknown properties to fail deserialization.
2.1
{
"MoreSetting": null
}
2.2
{
"MoreSettings": {
"Values": 42
}
}
I don't think I can use MissingMemberHandling since it will fail on missing values. I only want to fail on unknown values. Alternatives?