Created
August 6, 2023 07:12
-
-
Save nishanc/5b48f9c945bc23f3c946b59aae4327cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[JsonUnmappedMemberHandling(JsonUnmappedMemberHandling.Disallow)] | |
public class MyPoco | |
{ | |
public int Id { get; set; } | |
} | |
JsonSerializer.Deserialize<MyPoco>("""{"Id" : 42, "AnotherId" : -1 }"""); | |
// JsonException : The JSON property 'AnotherId' could not be mapped to any .NET member contained in type 'MyPoco'. | |
// Set JsonSerializerOptions.UnmappedMemberHandling to either Skip or Disallow. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment