After a deserialization I get some object null, this cause an exception in the deserialization so I've avoided the problem setting the appropriate property in the class:
[JsonProperty("jerseyNumber", NullValueHandling = NullValueHandling.Ignore)]
public int jerseyNumber { get; set; }
The problem is that after the deserialization, the value of the int
is equal to 0 because in the JSON is null.
I want set this null
value to empty, how can I achieve this?
I've tryed also with: [DefaultValue("Null")]
but don't working because the value is an integer.
将int设置为nullable
为nullable
尝试如下:
public int? jerseyNumber { get; set; }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.