How to convert a JSON string that can represent multiple types of classes?

Viewed 55

I am currently trying to build a message engine. This message receives a JSON string that can represent multiple classes as for example:

Class1 has properties A and B Class2 has properties X and Y

How do I know what class to deserialize into? Is there a way to detect that the string represents a Class1 object or a Class2?

Thank you

0 Answers
Related