using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Web.Script.Serialization; namespace WebApplication1 { public partial class WebForm4 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { OneObj first = new OneObj(); first.ID = 1; first.Name = "张三"; first.Time = DateTime.Now; JavaScriptSerializer a = new JavaScriptSerializer(); string aa=a.Serialize(first); OneObj ff = a.Deserialize<OneObj>(aa); } } public class OneObj { public int ID { get; set; } public string Name { get; set; } public DateTime Time { get; set; } } }