We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 99a193d commit e296c5aCopy full SHA for e296c5a
docs/standard/serialization/system-text-json/snippets/nullable-annotations/Nullable.cs
@@ -73,17 +73,6 @@ public static void RunIt()
73
string jsonMissing = """{}""";
74
var resultMissing = JsonSerializer.Deserialize<Person>(jsonMissing, options);
75
Console.WriteLine(resultMissing.Name is null); // True.
76
-
77
- // Explicit null value - DOES throw an exception.
78
- string jsonNull = """{"Name":null}""";
79
- try
80
- {
81
- JsonSerializer.Deserialize<Person>(jsonNull, options);
82
- }
83
- catch (JsonException ex)
84
85
- Console.WriteLine(ex.Message); // The constructor parameter 'Name' on type 'Person' doesn't allow null values.
86
87
}
88
89
record Person(string Name);
0 commit comments