You can use the Binder property in JsonSerializerSettings .
This blog post (by the library author) describes the steps: http://james.newtonking.com/archive/2011/11/19/json-net-4-0-release-4-bug-fixes.aspx
In short, you create your own class from the SerializationBinder and override two methods:
BindToName(Type serializedType, out string assemblyName, out string typeName)BindToType(string assemblyName, string typeName)
The logic that you place in these methods will give you direct control over how type names are converted to a string representation in the $type field and how types are located at the time the given values ββfrom $type executed.
In your case, if you want to omit the name of the Assembly, you can probably do:
public override void BindToName( Type serializedType, out string assemblyName, out string typeName) { assemblyName = null; typeName = serializedType.FullName; } public override Type BindToType(string assemblyName, string typeName) { return Type.GetType(typeName); }
source share