title: Deserialising loosely typed json with interfaces
body: <p>I have a rather loosely typed .json file which I'd like to deserialise.
  The JSON is basically a condition list which controls a decision making.</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;or&quot; : [
       &quot;and&quot; : [
         {
           &quot;bool&quot; : {
            &quot;expected&quot; : true,
            &quot;actual&quot; : false
           }
         }, 
        {
          &quot;bool&quot; : {
           &quot;expected&quot; : false,
           &quot;actual&quot; : false
          }
        }
       ]
  .
  .
  .
  </code></pre>
  <p>And the classes look like this:</p>
  <pre class="lang-cs prettyprint-override"><code>    public class BoolCondition : ICondition
      {
          private readonly bool _expected;
          private readonly bool _actual;
  
          public BoolCondition(bool expected, bool actual)
          {
              _expected = expected;
              _actual = actual;
          }
  
          public bool Eval()
          {
              return _expected.Equals(_actual);
          }
      }
  
      public class AndCondition : ICondition
      {
          public ICondition[] Conditions { get; set; }
  
          public AndCondition()
          {
          }
  
          public bool Eval()
          {
              return Conditions.All(c =&gt; c.Eval());
          }
      }
  
      public class OrCondition : ICondition
      {
          public ICondition[] Conditions { get; set; }
  
          public bool Eval()
          {
              return Conditions.Any(c =&gt; c.Eval());
          }
      }
  </code></pre>
  <p>There is an interface called ICondition and the &quot;or&quot;, &quot;and&quot;, &quot;bool&quot;, and other conditions are implementing this interface.
  Of course, there can be any structure in this tree.</p>
  <p>Is there any idea how I could deserialise this JSON?</p>