I post my solution here, which does not require a Json.NET modification:
The problem is that the following line is not enough for Silverlight:
string json1 = "{\"$type\":\"AmberGIS.NetworkTrace.DTO.NTPoint, NetworkTrace.DTO.Assembly\" ... }";
It is required:
string json1 = "{\"$type\":\"AmberGIS.NetworkTrace.DTO.NTPoint, NetworkTrace.DTO.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null \", ...}";
So, my way to include this in JSON (in my case, JSON cannot be changed since it appeared from the server and JSON.net was not created) is to manually modify JSON by iterating over all (nested) objects and inserting information about assembly:
string json = <some json you want fixed> Type type = <the target type you want> JObject jsonObject = JObject.parse (json); jsonObject["$type"] = type.FullName + ", " + type.Assembly.FullName; json = jsonObject.ToString(Formatting.None, null);
Then you can deserialize as usual using
JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }; var n1 = JsonConvert.DeserializeObject<NTPoint>(json, settings);
che javara
source share