日期:2014-05-18 浏览次数:20624 次
static void Main(string[] args) { string json = "[[\"3/17/2012\",[[0,0],[0,0],[0,0],[0,0],[0,0]],200]]"; var jss = new JavaScriptSerializer(); var data = jss.Deserialize<dynamic>(json); var d = data[0]; var m = new Model(); m.p_OutTime = Convert.ToDateTime(d[0]); m.p_SingleRoomPrice = d[1][0][0]; m.p_SingleRoomSum = d[1][0][1]; m.p_ParRoomPrice = d[1][1][0]; m.p_ParRoomSum = d[1][1][1]; m.p_AdminRoomPrice = d[1][2][0]; m.p_AdminRoomSum = d[1][2][1]; m.p_LuxuryRoomPrice = d[1][3][0]; m.p_LuxuryRoomSum = d[1][3][1]; m.p_PresRoomPrice = d[1][4][0]; m.p_PresRoomSum = d[1][4][1]; m.p_CountRomm = d[2]; } class Model { public decimal p_SingleRoomPrice { get; set; } public int p_SingleRoomSum { get; set; } public decimal p_ParRoomPrice { get; set; } public int p_ParRoomSum { get; set; } public decimal p_AdminRoomPrice { get; set; } public int p_AdminRoomSum { get; set; } public decimal p_LuxuryRoomPrice { get; set; } public int p_LuxuryRoomSum { get; set; } public decimal p_PresRoomPrice { get; set; } public int p_PresRoomSum { get; set; } public DateTime p_OutTime { get; set; } public int p_CountRomm { get; set; } }
------解决方案--------------------
这个都不是标准的JSON数据,要么就是按照规律来找,要么正则吧。