title: Deserialization of JSON from previous data model with Custom Converters fails when deserializing collections of Interfaces
body: <p>I am responsible for maintaining a game system where users persist JSON serialized POCOs in a local cache to preserve state of, e.g., a <code>Character</code>.</p>
  
  <p>The newest version of the code has changed the data model of these serialized objects.  In particular, a new interface was created.  This is creating issues when deserializing old copies of characters into the new code.  I am attempting to resolve these with custom converters, but I'm running into trouble.</p>
  
  <p>old, serialized version:</p>
  
  <pre><code>public class Character{
    public Skill Parent {get;set;}
    public Dictionary&lt;string,Skill} Skills {get;set;}
  }
  
  public class Skill {
  //normal stuff here.
  }
  </code></pre>
  
  <p>new version: </p>
  
  <pre><code>public class Character{
    [JsonProperty, JsonConverter(typeof(ConcreteTypeConverter&lt;Dictionary&lt;string,Skill&gt;&gt;))]
    public Dictionary&lt;string,ISkill} Skills {get;set;}
  }
  
  public class Skill:ISkill {
  //normal stuff here.
  }
  
  public interface ISkill{
  //stuff that all skill-like things have here
  }
  </code></pre>
  
  <p>I have further defined a custom converter class (having read <a href="https://stackoverflow.com/questions/5780888/casting-interfaces-for-deserialization-in-json-net#">this</a> and <a href="http://blog.greatrexpectations.com/2012/08/30/deserializing-interface-properties-using-json-net/" rel="nofollow noreferrer">this</a>, </p>
  
  <p>but i'm still running into trouble deserializing collections.  </p>
  
  <pre><code>public class Extensions 
  {
  
  //a lot of serializer extensions here including the Deserialize method
   private static readonly CustomSerializationBinder Binder = new CustomSerializationBinder();
          private static readonly JsonSerializerSettings JsonSerializerSettings = new JsonSerializerSettings
          {
              NullValueHandling = NullValueHandling.Ignore,
              ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
              TypeNameHandling = TypeNameHandling.Objects,
              TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple,
              Binder = Binder,
          };
  }
  
  
   public class CustomSerializationBinder : DefaultSerializationBinder
      {
  
  
          public override Type BindToType(string assemblyName, string typeName)
          {
  
               return base.BindToType(assemblyName, typeName);
  
  
          }
      }
  
      public class ConcreteTypeConverter&lt;T&gt; : JsonConverter
      {
          public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
          {
              serializer.Serialize(writer,value); // serialization isnt't the problem.
          }
  
          public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
          {
              if (typeof (T)==typeof(Dictionary&lt;string,Skill&gt;))
              {
                  var retVal = new object();
                  if (reader.TokenType == JsonToken.StartObject)
                  {
                      T instance = (T)serializer.Deserialize(reader, typeof(T));  //crashes here
                      retVal = new List&lt;T&gt;() { instance };
                      return retVal;
                  }
              }
  
              return serializer.Deserialize&lt;T&gt;(reader);
          }
  
          public override bool CanConvert(Type objectType)
          {
              return true; // kind of a hack 
          }
      }
  </code></pre>
  
  <p>So i have an <strong>old</strong> <code>Dictionary&lt;string,Skill&gt;</code> and I can't cast that to <code>Dictionary&lt;string,ISkill&gt;</code> in any code-path that I can see.   How should I resolve this?</p>