I have a user class like
public class User
{
public string UserName {get;set;}
public string Application {get;set;}
}
Now, I am using it like
var jsonSerializer = new DataContractJsonSerializer(typeof(User));
var objApp = (User)jsonSerializer.ReadObject(new MemoryStream(Encoding.Unicode.GetBytes(JsonInput)));
But my JSON JsonInput doesn't contain both values for example Application is not available in the JSON. This still serializes with on only UserName. The JSON and class above is an example, there are quite a few members for me to check them individually ! I want to make sure, the JSON contains all the members of the class, if not , throw error.
But I can't seem to find way. What am I missing here?