0

I have written a custom serializer and attached it to my RestClient. I am trying to also implement a custom deserializer as well. I noticed in my code that the serializer gets called when i added it to my client like so :RestClient Client = new RestClient(options).UseSerializer<CustomJsonSerializer>();

However, I am not sure what code to add to point to my custom deserializer and where to add it.

I am trying to call a method that essentially hijack's the response content, changes the string, and then sends the modified string back as the new response content to then be deserialized.

Where would i add the code to call my custom deserializer? What would the code snippet look like? And is it possible to even alter the response.content before the deserialization happens? And if so, how do i implement that?

1 Answers1

0

The UseSerializer<T> expects T to be IRestSerializer, which has properties for ISerializer and IDeserializer. The Deserializer property needs to return your custom deserializer.

public interface IRestSerializer {
    ISerializer   Serializer   { get; }
    IDeserializer Deserializer { get; }
...
Alexey Zimarev
  • 17,944
  • 2
  • 55
  • 83