views:

236

answers:

1

Hi,

I am using Json.NET to serialize an object graph. For each object that is serialized or deserialized, I want to call a method on that object before the serialization takes place. For e.g. all my objects implement an interface INotified with a method OnSerializing. I want OnSerializing to be called before the object is serialized.

Is there a way to achieve this without having to touch the Json.NET source code?

+2  A: 

The latest version of Json.NET supports serialization callbacks.

James Newton-King