0

I have a ExtensionDataObject (System.Runtime.Serialization.ExtensionDataObject) field in a API response. And in this field there is customer data, not serialization tool data. Whoever designed the API didn't think much about this field, I guess.

I want to serialize the response as JSON and save it to cache (Redis). But when I serialize the response to JSON, ExtensionDataObject field disappears.

I am using

Newtonsoft.Json.JsonConvert.SerializeObject(value);

How can I serialize the data including ExtensionDataObject?

emert117
  • 1,268
  • 2
  • 20
  • 38
  • You might be able to use the same trick as [ExtensionDataObject not marked as serializable](https://stackoverflow.com/a/32129411/37441820) and re-serialize the `ExtensionDataObject` to an embedded XML string during JSON serialization. Would something like that meet your needs? – dbc Jun 15 '19 at 08:49
  • I read that answer. I don't want to serialize a part of data to XML and deserialize a part of data form XML every time I need the data. But I will try and measure performance hits – emert117 Jun 15 '19 at 09:02
  • Did you consider redisjson.io? – Guy Korland Jun 15 '19 at 09:28

0 Answers0