I have an ASP.NET web API project, and since it does not support the presence of two body parameters, I use the JObject parameter and then extract the actual parameters from it. Like this.
Public bool mymethod(JObject data){ myclassA a = data["a"].toObject<myclassA>(); myclassA b = data["b"].toObject<myclassB>(); }
But 2 types of classes implement ISerializable, and I need JSON.NET to ignore it. I installed the default JSON.NET serializer to do this, and it works fine when serialization is done automatically.
But I need to get a link to the built-in JSON.NET serializer so that I can use it like in the code above.
myclassA b = data["b"].toObject<myclassB>(defaultSerializer);
I am currently creating a new instance of the JSON.NET serializer and using it. But how can I get a link to the default built-in serializer in asp.net WEB API?
Also, I canβt change anything in class types, as this is a kind of obsolete application that I convert to web api. Thank.
Amila Mar 13 '13 at 14:43 2013-03-13 14:43
source share