title: How to specify polymorphic type in ASP.NET mvc 6
body: <p>I could use "TypeNameHandling = TypeNameHandling.Auto" in previous version of MVC.
  In MVC6, I have following class</p>
  
  <pre><code>public class BaseClass {
      public string Id {get;set;}
  }
  public class Foo : BaseClass {
      public string Name {get;set;}
      public string Address {get;set;}
  }
  public class Bar : BaseClass {
      public string Account {get;set;}
      public string Password {get;set;}
  }
  </code></pre>
  
  <p>In my webapi, JSON result will be the following</p>
  
  <pre><code>[
      {Id: "1", Name: "peter", Address: "address1"},
      {Id: "2", Account: "mary", Password: "1234"}
  ]
  </code></pre>
  
  <p>But I want the following result:</p>
  
  <pre><code>[
      {$type: "Foo", Id: "1", Name: "peter", Address: "address1"},
      {$type: "Bar", Id: "2", Account: "mary", Password: "1234"}
  ]
  </code></pre>