Open mikethea1 opened 5 months ago
record R([JsonProperty(Required = Required.Always)] string A, [JsonProperty(Required = Required.Always)] string[] B);
{}
Deserialization error because the required properties were not present.
Deserializes successfully with all properties null.
JsonConvert.DeserializeObject<R>("{}");
Your attribute is invalid, try to use [property:JsonProperty...]
@MO2k4
No, the application of the attribute as shown is not invalid. It's meant to support constructor parameters:
https://github.com/JamesNK/Newtonsoft.Json/blob/2eaa475f8853f2b01ac5591421dcabd7a44f79ce/Src/Newtonsoft.Json/JsonPropertyAttribute.cs#L34-L35
Source/destination types
Source/destination JSON
Expected behavior
Deserialization error because the required properties were not present.
Actual behavior
Deserializes successfully with all properties null.
Steps to reproduce