How to serialize class type but not the namespace to a Json string using DataContractJsonSerializer
问题 I'm trying to serialize a class hierarchy to a Json string using DataContractJsonSerializer , in a WCF service. the default behaviour for serializing a derived class is to add the following key value pair to the object: "__type":"ClassName:#Namespace" My problem is that namespaces are long and they bloat the Json string. I would like to somehow intervene with the serialization and output this instead: "__type":"ClassName" and on deserialization intervene again to point to the correct