/// <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); }
/// <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()); }