| TypeNameHandling Enumeration |
Namespace:
Newtonsoft.Json
Assembly:
Newtonsoft.Json (in Newtonsoft.Json.dll) Version: 12.0.1+509643a8952ce731e0207710c429ad6e67dc43db
Syntax [FlagsAttribute]
public enum TypeNameHandling
Members
| Member name | Value | Description |
---|
| None | 0 |
Do not include the .NET type name when serializing types.
|
| Objects | 1 |
Include the .NET type name when serializing into a JSON object structure.
|
| Arrays | 2 |
Include the .NET type name when serializing into a JSON array structure.
|
| All | 3 |
Always include the .NET type name when serializing.
|
| Auto | 4 |
Include the .NET type name when the type of the object being serialized is not the same as its declared type.
Note that this doesn't include the root serialized object by default. To include the root object's type name in JSON
you must specify a root type object with SerializeObject(Object, Type, JsonSerializerSettings)
or Serialize(JsonWriter, Object, Type).
|
Remarks TypeNameHandling should be used with caution when your application deserializes JSON from an external source.
Incoming types should be validated with a custom
SerializationBinder
when deserializing with a value other than
None.
See Also