Platform : C# IDE : Microsoft Visual Studio 2010
I am new to Json and wondering on how to handle the error converting value {null} to type system.Int32 in an input. Any suggestion?
Another option is to ignore null values.
JsonConvert.DeserializeObject<YourType>(jsonText, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
You could use replace your Int32
s with their nullable counterpart using int?
. You can find more about nullable types here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With