Piyush Sardana
Piyush Sardana

Reputation: 1758

JsonConverter in Manatee Json

I am using Manatee Json for de-/serialization. I want to do use the similar functionality which is available in Netwonsoft where one can override JsonConverter Read and Write Json. Do we have an example on how to do that in Manatee?

Upvotes: 1

Views: 89

Answers (1)

gregsdennis
gregsdennis

Reputation: 8428

Manatee.Json works a bit differently than Json.Net.

With Json.Net, you implement a reader or writer where you translate directly between the JSON and the object.

With Manatee.Json, you don't have to worry about the JSON so much. Instead you translate to a JsonValue.

You have a couple primary options on how you can do this:

  • If you own the object (you have the .cs file for it), the best approach is to have it implement IJsonSerializable. The serializer prioritizes for this.
  • If you don't own the object, you can create an ISerializer implementation to perform the translation.

The serialization docs give a lot more detail.

Upvotes: 0

Related Questions