text: CodePlexProject Hosting for Open Source Software
  It is possible to deserialize an object based on a "__type" property? something like Asp.Net Ajax does, but more: all of object's properties that are complex objects to be deserialized based on a "__type" property.
  My problem is that for some properties I don't know exactly what type will come from the client; for example:
  class Data
  {
  .....
  Animal myAnimal; // here can be a Horse type, a Dog type, etc, all deriving from the base Animal type.
  }
  Just found the solution: TypeNameHandling
  I had a question about the same functionality. It looks like the type resolution is hard coded in the JsonSerializerInternalWriter and JsonSerializerInternalReader to use the fully qualified assembly name. Without patching these two classes to
  use a strategy pattern for type name resolution, is there an existing extension point that can be used to change this behavior? I'd like to use namespaces instead so I can match the behavior of the DataContractSerializer.
  What do you mean by namespaces like DataContractSerializer? How is that different/better?
  James,
  Here's the link to the docs:. It starts under the header "Polymorphism Preserving Type Information".
  IMO, it is better because 1) you don't have to expose the fully qualified assembly name to clients 2) less characters to represent the type informaton.
  That only works because types are registered with the serializer as "KnownTypes" before deserializing. I definitely don't want people have to do that to get type preserving to work.
  I certainly understand that aspect. Is there any concern in exposing this as a pluggable strategy though with the defaults staying as is?
  Are you sure you want to delete this post? You will not be able to recover it later.
  Are you sure you want to delete this thread? You will not be able to recover it later.