Question

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?

Was it helpful?

Solution

The latest version of Json.NET supports serialization callbacks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top