In the Json deserialization model, I have a class member that can be a single item or an array, thus I use a JsonConverter to deal with it.
However, sometimes the entire property is missing in the response as well. The model has a property that the Json response sometimes does not, so I am using [JsonProperty(Required = Required.Always)]
.
public class Reservation
{
[JsonConverter(typeof(SingleOrArrayConverter<Resource_Reservation>))]
[JsonProperty(Required = Required.Always)]
public List<Resource_Reservation> resource_reservation { get; set; }
The problem is when missing class property passes through the ReadJson
method in the JsonConverter, it raises exception.
My question is whether I can add missing property logic check in the JsonConverter, or do I need to deal with the exception as is.