Here\'s my dilemma. I\'m using a RESTful ASP.NET service, trying to get a function to return a JSON string in this format:
{\"Test1Key\":\"Test1Value\",\"Te
Expanding slightly on @MarkisT's excellent solution, you can modify the serialization constructor to recreate one of these dictionaries from the same JSON (thus allowing you to take an AjaxDictionary as a service parameter), as follows:
public AjaxDictionary( SerializationInfo info, StreamingContext context )
{
_Dictionary = new Dictionary();
foreach (SerializationEntry kvp in info)
{
_Dictionary.Add((TKey)Convert.ChangeType(kvp.Name, typeof(TKey)), (TValue)Convert.ChangeType(kvp.Value, typeof(TValue)));
}
}