New issue 47 by jhes...@gmail.com: Cannot deserialize List<>
http://code.google.com/p/jayrock/issues/detail?id=47
When trying to deserialize list, an exception is thrown.
bool isGenericList = Reflector.IsConstructionOfGenericTypeDefinition(type,
typeof(IList<>));
returns false for List<> but can be fixed with
bool isGenericList = Reflector.IsConstructionOfGenericTypeDefinition(type,
typeof(IList<>)) || Reflector.IsConstructionOfGenericTypeDefinition(type,
typeof(List<>));
Line can be found in ImportContext.FindCompatibleImporter(Type t)
Comment #2 on issue 47 by aziz...@gmail.com: Cannot deserialize List<>
http://code.google.com/p/jayrock/issues/detail?id=47
This is by-design. You need to import as IList<T>, not List<T>. List<T> is
a specific and concrete implementation of IList<T> that is meant for
internal use by your code but not mean to be exposed in a public member.
The following will fail:
JsonConvert.Import<List<int>>("[1,2,3]")
The following two, however, will succeed:
JsonConvert.Import<IList<int>>("[1,2,3]")
JsonConvert.Import<ICollection<int>>("[1,2,3]")