title: Json.net deserialize interface, concrete class uses a JsonConverter
body: <p>My problem is that my JsonConverter doesn't seem to get invoked by the json.net de-serialization process when the converter is applied to an implementation of an interface, and the propertytype is the interface.
  I use TypeNameHandling = TypeNameHandling.Objects to add $type to the json. I do so both on serialization and on de-serialization.
  And when I have a property that is of an implementation of the interface the class' converter is invoked properly.
  But when I have a property of interface type, the concrete class' converter is not invoked.</p>
  
  <p>When I deserialize this class my JsonDataBagCreationConverter will be invoked by the RealTelephone but not by the Telephone because this is an interface.
  Even though they are both serialized with the correct $type.
  This results in RealTelephone having its .Data filled whereas Telephones .Data is null.</p>
  
  <pre><code>[JsonConverter(typeof(JsonDataBagCreationConverter&lt;ContainerForITelephone&gt;))]
  public class ContainerForITelephone : IDataBag
  {
      private object _data;
      private DataBagTypeEnum _dataBagTypeEnum;
      public ITelephone Telephone { get; set; }
      public Telephone RealTelephone { get; set; }
  
      public object Data
      {
          get { return _data; }
          set { _data = value; }
      }
  
      public DataBagTypeEnum DataBagType_Enum
      {
          get { return _dataBagTypeEnum; }
      }
  }
  </code></pre>
  
  <p>This jsonconverter is not invoked for the Telephone property. But it is for RealTelephone.</p>
  
  <pre><code>public class JsonDataBagCreationConverter&lt;T&gt; : JsonConverter where T : IDataBag, new()
  {       
      public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
      {           
          if (reader.TokenType != JsonToken.Null) 
          {
              var jsonObject = JObject.Load(reader);
              var target = Create(objectType, jsonObject);
              serializer.Populate(jsonObject.CreateReader(), target); 
              ((IDataBag)target).Data = jsonObject.ToString(); 
              return target;
          }
          return null;
      }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>[JsonConverter(typeof(JsonDataBagCreationConverter&lt;Telephone&gt;))]
  public class Telephone : ITelephone
  {
      public string Name { get; set; }
      public string AreaCode { get; set; }
      public string Number { get; set; }
      public SubPhone SubPhone { get; set; }
  
      public object Data { get; set; }
      public DataBagTypeEnum DataBagType_Enum { get; set; }
  }
  </code></pre>
  
  <p>I look forward to hearing from you, thanks</p>
  
  <p>Jan</p>