I want to serialize and deserialize an ExpandoObject with non-trivial values. Some values of the ExpandoObject contain objects with properties leading to circular references.
I wrote a custom serializer/deserializer for these objects. These objects however occur on many places within the ExpandoObject (also nested, not only on the root-level). But they always have the same key! I want the deserializer to take my custom deserializer for every property of the ExpandoObject of a certain key.
For example:
{
"a": 12.5,
"b": "hello world",
"special": { /* ... */ },
"c": -4,
"d":
{
"x": "test",
"special": { /* ... */ },
"y": 152
},
"e": 9053
}
I want every property special to be deserialized with my custom deserializer to my class. Everything else should be handled by the default deserializer.
Am I on the right track to handle my kind of problem? If yes, how can I achieve this using JSON.NET?