public partial class json序列化 :
System.Web.UI.Page
{
protected void Page_Load(object
sender, EventArgs e)
{
StringBuilder builder = new StringBuilder();
builder.Append("{");
builder.Append(" \"CommonConfig\":
{");
builder.Append("
\"ChannelDepartmentCode\":
\"9904\"");
builder.Append("
}");
builder.Append("}");
JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
PageConfig
t = jsonSerializer.Deserialize<PageConfig>(builder.ToString());
}
}
public class PageConfig
{
public CommonConfig CommonConfig
{ get; set; }
}
public class CommonConfig
{
public string
ChannelDepartmentCode { get; set; }
}
可以将一些配置信息已json格式存在数据库中读取的时候序列化。,码迷,mamicode.com