I have the following , but the json string has some empty array that are no returned as empty. How can i set that options value to return regardless ?
vat det = JsonConvert.DeserializeObject<RootObject>(json, "does option setting go here")
I have the following , but the json string has some empty array that are no returned as empty. How can i set that options value to return regardless ?
vat det = JsonConvert.DeserializeObject<RootObject>(json, "does option setting go here")
There is something called a JsonSerializerSettings class where these kind of settings can be set. These settings can then be passed to with the DeserializeObject all after the json string. The setting you are looking for is called DefaultValueHandling this will be a enumerator in the settings with multiple settings. To see what is posible with these settings see their documentatie.
Your code will be looking something like this:
var result = JsonConvert.DeserializeObject<RootObject>("json string", new JsonSerializerSettings
{
DefaultValueHandling = DefaultValueHandling.Ignore
});