Json.NET supports serialization callback methods. A callback can be used to manipulate an object before and after its serialization and deserialization by the JsonSerializer.

- OnSerializing

- OnSerialized

- OnDeserializing

- OnDeserialized

To tell the serializer which methods should be called during the object's serialization lifecycle, decorate a method with the appropraite attribute (T:System.Runtime.Serialization.OnSerializingAttribute, T:System.Runtime.Serialization.OnSerializedAttribute, T:System.Runtime.Serialization.OnDeserializingAttribute, T:System.Runtime.Serialization.OnDeserializedAttribute).

# Example

Example object with serialization callback methods:

Serialization Callback Attributes

The example object being serialized and deserialized by Json.NET:

Serialization Callback Example

T:System.Runtime.Serialization.OnSerializingAttribute
T:System.Runtime.Serialization.OnSerializedAttribute
T:System.Runtime.Serialization.OnDeserializingAttribute
T:System.Runtime.Serialization.OnDeserializedAttribute