예제 #1
0
        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);
        }
예제 #2
0
        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);
        }