I noticed that with a DataContractJsonSerializer, a serialized JSON string sometimes includes type information in the form
{"__type":"MyClass:#MyNamespace", ... }
according to my observations, it seems that this happens only when serialization of the base type is passed instead, but to the known sub type, which makes sense, but I did not find official documentation to confirm this, or even in any case, to force the serializer to consistently manifest this behavior whenever it encounters a custom type.
Can anyone confirm the correctness of my observations? Better yet, if you know how to instruct the serializer to always serialize type information for custom types, if at all possible?
Thanks,
theburningmonk
source share