Base solution for your next web application
Open Closed

Modifying DTOs properties before serialization. #1383


User avatar
0
gunpal5 created

Hello,

I want to modify some properties of my DTOs before it gets serialized.

e.g. I have a FileDto which has a property for virtual path (e.g. "~/storage/myfile.jpg") of stored file on disk. I want to convert it to an absolute Uri (like "http://mydomain/storage/myfile.jpg") before the instances of FileDtos get serialized.

Is there any interface or something to modify the DTOs before serialization?

Regards, Gunpal Jain


1 Answer(s)
  • User Avatar
    0
    gunpal5 created

    Nevermind, I found the solution: <a class="postlink" href="http://www.newtonsoft.com/json/help/html/SerializationCallbacks.htm">http://www.newtonsoft.com/json/help/htm ... lbacks.htm</a>

    Regards, Gunpal Jain