title: Exclude items during deserialization if a specific attribute doesn't exist
body: <p>I have a JSON string which can contain multiple students and teachers.  An example is shown below.  I want to deserialize the JSON into separate lists based on whether it contains a particular attribute.</p>
  
  <pre><code>[
    {
      "School": "St.Xavier"
    },
    {
      "teacherid": 1,
      "name": "Prof.Xavier",
      "position": "Professor",
      "class": "elite"
    },
    {
      "studentid": 1,
      "name": "QuickSilver",
      "ability": "Rush",
      "class": "elite"
    }
  ]
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>List&lt;Teacher&gt; teacherList = JsonConvert.Deserialize&lt;Teacher&gt;(json);
  List&lt;Student&gt; studentList = JsonConvert.Deserialize&lt;Student&gt;(json);
  </code></pre>
  
  <p>During deserialization, school info will be ignored, and each list will contain only those items with attributes matching according to the class. So <code>teacherList</code> will contain only teacher info, and <code>studentList</code> will contain only student info.</p>
  
  <pre><code>public class Teacher
  {
      [JsonProperty("teacherid")]
      public string TeacherID {get;set;}
  
      [JsonProperty("name")]
      public string Name {get;set;}
  
      [JsonProperty("position")]
      public string Position {get;set;}
  
      [JsonProperty("class")]
      public string InCharge {get;set;}
  }
  
  public class Student
  {
      [JsonProperty("studentid")]
      public string StudentID {get;set;}
  
      [JsonProperty("name")]
      public string Name {get;set;}
  
      [JsonProperty("ability")]
      public string Ability {get;set;}
  
      [JsonProperty("class")]
      public string Enrolled {get;set;}
  }
  </code></pre>
  
  <p>How can I do this?</p>