title: How to deserialize array of different types from JSON
body: <p>I have JSON string that looks like:</p>
  
  <pre><code>{
      "type": "group",
      "logicalOperator": "or",
      "conditions":[{
              "type": "condition",
              "metric": "CTR",
              "operator": "&gt;=",
              "value": "123"
          },
          {
              "type": "group",
              "logicalOperator": "and",
              "conditions": [{
                  "type": "condition",
                  "metric": "CTR",
                  "operator": "&gt;=",
                  "value": "123"
                  }]
          }
      ]
  }
  </code></pre>
  
  <p>I want to deserialize it into C# classes (using <code>Newtonsoft.JSON</code>). But the point that <code>conditions</code> can include <code>group</code> or <code>condition</code> make problem for me.</p>
  
  <pre><code>public class Group {
      public string logicalOperator { get; set; }
      public List&lt;object&gt; conditions { get; set; }
  }
  
  public class Condition {
      public string metric { get; set; }
      public string @operator { get; set; }
      public int value { get; set; }
  }
  </code></pre>
  
  <p>How can I get rid of the <code>List&lt;object&gt;</code>? TIA!</p>