json 格式

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; } }
}

 

posted @ 2016-04-05 17:37  李子俊  阅读(90)  评论(0编辑  收藏  举报