I am passing a simple JSON string from my C# client to my webservice . Following is the string I send
"{ \"name\":\"S1\" }"
At the service end I use the following code
class DataDC
{
public String attr { get; set; }
public String attrVal { get; set; }
}
JavaScriptSerializer json_serializer = new JavaScriptSerializer();
DataDC dc = (DataDC)json_serializer.DeserializeObject(str);
I get the following error
"Unable to cast object of type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' to type 'DataDC'."