-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Type of issue
Missing information
Description
JavaScript distinguishes between null and undefined and when JSON is deserialized a missing value becomes undefined. However, undefined does not exist in .NET and a missing string or object value deserializes to .NET null. This can lead to confusion when setting RespectNullableAnnotations to true because if the JSON value is missing, no exception is thrown when the target property is non-nullable leading to the property being null despite the setting. I think this article could be improved by explaining this.
Even better, it would be nice if JSON deserialization could be configured to treat a missing value the same way as null when deserializing to a non-null string or object. 🙏 Yes, I know this is not a documentation issue, but I had to mention it. 😀
Page URL
Content source URL
Document Version Independent Id
7ae3d826-764a-2c29-a251-1a237beedd1a
Platform Id
5aacc351-ddac-0ce8-57df-aabac452d55b
Article author
Metadata
- ID: 44d16e49-e10a-92b0-147e-a46542aefd51
- PlatformId: 5aacc351-ddac-0ce8-57df-aabac452d55b
- Service: dotnet-fundamentals
Metadata
Metadata
Labels
Type
Projects
Status