I have a problem when deserializing JSON with a string property value of "0". It gets deserialized to null
.
{
"name":"Some name",
"isConfigProperty":true,
"displayProperty":false,
"default":"0"
}
This is my class to deserialize to:
public class PropertyModel
{
public string Name { get; set; }
public bool IsConfigProperty { get; set; }
public bool DisplayProperty { get; set; }
public string Default { get; set; }
}
When I change Default
value from "0" to "1" or any other number/value it deserializes as it should. But when I change it to "0", I get null
again.
Does anyone know about this? Is it possibly a bug in NewtonsoftJson
or am I missing something?
Thank you.