Zero Dictionary Deserialization Processing

I am deserializing an object using JsonConvert in C # and for a field in my object, I tried to deserialize Dictionary<int,string>, so I used the attribute in the field in my class as follows:

[JsonProperty("variablephysicalproperties", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<int,string> VariablePhysicalProperties { get; set; }

Thus, deserialization works fine when the value of this property, for example:

"variablephysicalproperties":{"1":"Sph\u00e8re (SPH)"}

But when there is no value in it like:

"variablephysicalproperties":[]

This does not work, I have a deserialization error. As shown above, I tried NullValueHandling = NullValueHandling.Ignorebut still not working

Can someone help me with this?

+4
source share

No one has answered this question yet.


All Articles