title: Fixing the deserializing of untrusted data using C#
body: <p>I have the following relevant C# code:</p>
  
  <pre><code>json = File.ReadAllText(path);
  isStudentObject= JsonConvert.DeserializeObject&lt;List&lt;XXStudentCode&gt;&gt;(json).Any(sv =&gt; sv.SCODE.Equals(code));
  </code></pre>
  
  <p>My security software (static code analysis) scans our apps and it does not like the above code, namely ReadAllText part. It says that this is a "high risk deserialization of untrusted data."</p>
  
  <p>So my question is this: how can I refactor this code to make the data "trusted?" I tried different validation methods and it did not work. Any help is appreciated. </p>