public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { WeChatBaseResponse data = new WeChatBaseResponse(); data.Ret = dictionary.GetValue("ret", 0); data.ErrMsg = dictionary.GetValue("err_msg", string.Empty); return(data); }
public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); WeChatBaseResponse data = (WeChatBaseResponse)obj; dictionary.AddNonDefaultValue("ret", data.Ret); dictionary.AddNonDefaultValue("err_msg", data.ErrMsg); return(dictionary); }