示例#1
0
        /// <summary>
        /// 反序列化json数据
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public static MyJsonResultMessageEntity JsonToEntity(string json)
        {
            JavaScriptSerializer      jsonSer = new JavaScriptSerializer();
            MyJsonResultMessageEntity jms     = jsonSer.Deserialize <MyJsonResultMessageEntity>(json);

            return(jms);
        }
示例#2
0
        /// <summary>
        /// 序列化发送JSON数据
        /// </summary>
        /// <param name="jms"></param>
        /// <returns></returns>
        public static string SendJson(MyJsonResultMessageEntity jms)
        {
            JavaScriptSerializer jsonSer = new JavaScriptSerializer();
            StringBuilder        sb      = new StringBuilder();

            jsonSer.Serialize(jms, sb);
            return(sb.ToString());
        }