0

I'm using NewtonSoft Json.Net to serialize my objects to JSON. On of my classes is not serializing correctly. I was wondering if it is possible to build a custom type serializer that will output different JSON.

How can I make a custom serializer/deserializer for a specific class?

Kees C. Bakker
  • 32,294
  • 27
  • 115
  • 203
  • 1
    If you can provide more details about your class and what the JSON needs to look like, I'd be happy to provide a specific example. Otherwise, you can look at [this answer](http://stackoverflow.com/q/18668617/10263), which demonstrates how to get around problems when serializing/deserializing the `IPAddress` and `IPEndpoint` classes. That may be enough to get you started. – Brian Rogers Nov 22 '13 at 15:33
  • @BrianRogers, thanks, but the answer of Dmytro helped me out. – Kees C. Bakker Nov 22 '13 at 15:47

1 Answers1

1

you may create your own Custom JsonConverter and implement its ReadJson and WriteJson methods.

Dmytro Rudenko
  • 2,524
  • 2
  • 13
  • 22