The following class does not deserialize (but does serialize) using System.Web.Script.Serialization.JavaScriptSerializer
.
public class foo {
public KeyValuePair<string, string>? bar {get;set;}
}
The attempt to deserialize results in a System.NullReferenceException
when System.Web.Script.Serialization.ObjectConverter.ConvertDictionaryToObject
reaches the bar
property. (Note, that is a surmise based on the stack trace.)
Changing the property type to KeyValuePair<string,string>
fixes the problem, but I d like to keep the Nullable
type if at all possible.
The JSON is exactly what you would expect:
{"foo": {
"bar": {
"Key":"Jean-Luc",
"Value":"Picard"
}
}}
Help?