Custom json.net serializer / deserializer for ExpandoObject special key

I want to serialize and deserialize ExpandoObject with non-trivial values. Some ExpandoObject values ​​contain objects with properties leading to circular references.

I wrote a custom serializer / deserializer for these objects. However, these objects are found in many places in ExpandoObject (also nested not only at the root level). But they always have the same key! I want the deserializer to take my own deserializer for each ExpandoObject property of a specific key.

For example:

{
    "a": 12.5,
    "b": "hello world",
    "special": { /* ... */ },
    "c": -4,
    "d":
        {
            "x": "test",
            "special":  { /* ... */ },
            "y": 152
        },
    "e": 9053
}

      

I want every feature to be deserialized with my custom deserializer in my class. Everything else should be handled by the default deserializer.

Am I on the right track to deal with my problem? If so, how can I achieve this using JSON.NET?

+3
c # serialization json.net deserialization


source to share


No one has answered this question yet

See similar questions:

4
Jess.NET Deserialization into dynamic bound object

or similar:

508
How can I deserialize JSON for a simple dictionary <string, string> in ASP.NET?
405
Remove json object descriptor to dynamic object using Json.net
339
How do I change property names when serializing with Json.net?
289
How do I implement a custom JsonConverter in JSON.NET to deserialize a list of base class objects?
48
Exclude property from serialization via custom attribute (json.net)
37
Registering custom JsonConverter globally in Json.Net
29
Can't serialize dictionary with complex key using Json.net
eleven
Using Json.net - Partial Custom C # Object Serialization
1
Serializing properties in JSON.NET throws an exception
1
Json.Net serialization gives wrong property to custom converter



All Articles
Loading...
X
Show
Funny
Dev
Pics