title: Deserialize Json object with multiple possible child types
body: <p>I'm trying to deserialize an object that basically has an array of objects where each one has a property with object type and object instance. The schema looks somewhat like this:</p>
  <pre><code>public class MainObject
  {
      public IEnumerable&lt;Parent&gt; Parents { get; set; }
  }
  
  public class Parent
  {
      public string NameOfChildObjectType { get; set; }
      public Object Child { get; set; }
  }
  
  public class Child_1
  {
      //some props
  }
  
  public class Child_2
  {
      //some props but different as child 1 or 3
  }
  
  public class Child_3
  {
      // completely different props literally the only thing we have in common is us being children
  }
  </code></pre>
  <p>And Json file</p>
  <pre><code>{
      &quot;id&quot;: &quot;1&quot;,
      &quot;Name&quot;: &quot;MainObjectName&quot;,
      &quot;Parents&quot;: [
          {
              &quot;ChildName&quot;: &quot;ChildOfType1&quot;,
              &quot;Parameters&quot;: {
                  &quot;Name&quot;: &quot;Jordan&quot;
              }
          },
          {
              &quot;ChildName&quot;: &quot;ChildOfType2&quot;,
              &quot;Parameters&quot;: {
                  &quot;Height&quot;: &quot;6`2&quot;
              }
          },
          {
              &quot;ChildName&quot;: &quot;ChildOfType3&quot;,
              &quot;Parameters&quot;: {
                  &quot;OwnedPets&quot;: [
                      {
                          &quot;DogName&quot;: &quot;JJ&quot;,
                          &quot;FishName&quot;: &quot;Shrimp&quot;
                      }
                  ],
                  &quot;MaxHeadRotation&quot;: &quot;45&quot;
              }
          }
      ]
  }
  </code></pre>
  <p>So is there any way I could define a generic type that isn't shared between all the objects in the list or even deserialize them in one go?
  Any ideas are appreciated.</p>