public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer) { SomeObjectModel TheObject = obj as SomeObjectModel; Dictionary <string, object> OutputJson = new Dictionary <string, object>(); OutputJson.Add("SomeKey", TheObject.GetType().GetProperty(_theJsonDictionary["SomeKey"]).GetValue(TheObject)); return(OutputJson); }
public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer) { SomeObjectModel TheObject = obj as SomeObjectModel; Dictionary <string, object> OutputJson = new Dictionary <string, object>(); foreach (var item in _theJsonDictionary.Keys) { OutputJson.Add(item, TheObject.GetType().GetProperty(_theJsonDictionary[item]).GetValue(TheObject)); } return(OutputJson); }