title: Abstract class property causes JSON.NET to throw during deserialization
body: <p>I have a web method that returns a collection of objects which have a property that is an abstract class. There are three types that derive from the abstract class.</p>
  <pre><code>public enum VehicleType { Train, Truck, Boat }
  
  public abstract class Vehicle
  {
      public VehicleType VehicleType { get; set; }
      ...
  }
  
  public class Train : Vehicle { ... }
  public class Truck : Vehicle { ... }
  public class Boat : Vehicle { ... }
  </code></pre>
  <pre><code>public class Shipment
  {
      public Vehicle TransportVehicle { get; set; }
  }
  </code></pre>
  <pre><code>[HttpGet]
  [Route(&quot;{customerId}/shipments&quot;)]
  public async Task&lt;ActionResult&lt;ShipmentsResponse&gt;&gt; GetCustomerShipments(intcustomerId, CancellationToken cancellationToken)
  {
      ...
      // Returns a ShipmentResponse which contains a collection of Shipment objects
  }
  </code></pre>
  <p>When the result is received by the client, JSON.NET attempts to deserialize the collection and throws this exception:</p>
  <p><strong>Could not create an instance of type Management.Domain.Models.Vehicle. Type is an interface or abstract class and cannot be instantiated. Path 'data.shipments[0].vehicle.vehicleType', line 1, position 462.</strong></p>
  <p>So I figured I could use a CustomCreationConverter for the Vehicle type:</p>
  <pre><code>public class VehicleConverter : CustomCreationConverter&lt;Vehicle&gt;
  {
      private VehicleType _currentVehicleType;
  
      public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
      {
          var jObject = JObject.ReadFrom(reader);
          _currentScheduleType = jObject[&quot;VehicleType&quot;].ToObject&lt;UserScheduleType&gt;();
          return base.ReadJson(jObject.CreateReader(), objectType, existingValue, serializer);
      }
  
      public override VehicleCreate(Type objectType)
      {
          switch (_currentVehicleType)
          {
              case VehicleType.Train:
                  return new Train();
              case VehicleType.Truck:
                  return new Truck();
              case VehicleType.Boat:
                  return new Boat();
              default:
                  throw new NotImplementedException();
          }
      }
  }
  </code></pre>
  <p>...but this code is never hit. Can anyone shed some light on how I can resolve this?
  Thanks for any advice!</p>