I have a simple class I want to deserialize a json string into :
public class ConnectClientResponse
{
public bool result { get; set; }
}
Call of the Deserialize method :
try
{
var response = JsonConvert.DeserializeObject<ConnectClientResponse>(jsonString);
}
catch (JsonSerializationException)
{
// Exception should be thrown
}
The issue is when the json string has the same form as the ConnectClientResponse class but the property name is not the same, no exception is thrown.
Is this a normal behaviour ? If so, how can I check if the properties names are the same ?
Exemple of invalid json, the property name doesn't match the ConnectClientResponse "result" property name :
{
"test" : true
}