I have a simple WCF RESTful service with only one operation which has string as a parameter void Process(string item)
. The item
is a JSON serialized object and it could be anything.
In this particular case about 20 different classes could be sent to this service. What is the proper and handy way to deserialize those objects? How do i know know what's actually behind the JSON? I could include some Type
field and do something like using Json.NET:
dynamic json = JsonConvert.DeserializeObject(input);
, examine json.Type
and then deserialize input string with JsonConvert.DeserializeObject<T>()
, but I am not sure that this is a good idea. Do you have any ideas?