asp.net接收php json传来的值
如题,现在想用asp.net实现接收php json过来的值,
这是PHP JSON后的值
{"title":"3333","summary":"333","group_id":"27","partner_id":"1","system":"Y","team_price":"1.00","market_price":"1.00","product":"333","condbuy":"","per_number":"0","permin_number":"1","mobile":null,"card":"0","bonus":"0","address":null,"detail":"333","notice":"333","express":"","express_relate":"N;","delivery":"coupon","state":"none","conduser":"N","buyonce":"N","team_type":"normal","sort_order":"0","expire_time":"1383062400","begin_time":"1375113600","end_time":"1375200000","reach_time":"0","close_time":"0","priceremark":"2222222","pricesummary":"222222222222222222","keywords":"22222222","referprice":"0.00","sellerprice":"0.00","phones":"22","checked":"N","gold_price":"0.00","silver_price":"0.00","smsmoban":"[\\u4ea7\\u54c1]\\u4e0b\\u5355\\u6210\\u529f\\uff0c\\u7535\\u5b50\\u7f16\\u7801\\uff1a[\\u7f16\\u53f7],\\u53ef\\u6d88\\u8d39[\\u5f20\\u6570]\\u6b21\\uff0c\\u6709\\u6548\\u671f\\uff1a[\\u6709\\u6548\\u671f]\\u3002\\u3010\\u8fd0\\u901a\\u56fd\\u65c5\\u3011","s_id":"","allowname":"N","validate_time":"0","allowtomorrow":"N","close":"Y","tuan_type":null,"traffic_type":null,"line_type":null,"preday":"0","bj_type":"0","carpark":null,"hoteltype":null,"fangtype":null,"bedtype":null,"partner_level":"1","theme_type":"1","pepole_type":"1","price_type":"1","ticket_type":"1","partneraddress":"22222","trafficguide":"3333","deliverydetail":"3333","partnertianqi":"44","mpnumber":"mp122345","create_time":1375066352,"author":"admin","dayprice":[{"id":"7","cdate":"1374854400","team_id":"6","amarket_price":"23.00","ayouhui_price":"23.00","ahuiyuan_price":"23.00","cmarket_price":"23.00","cyouhui_price":"23.00","chuiyuan_price":"23.00","allowdingjin":"Y"}]}
string tmp = Request["data"].ToString();//接收POST数据
//实例化对象
JavaScriptSerializer serializer = new JavaScriptSerializer();
//JSON序列化
string result = serializer.Serialize(tmp);
//JSON反序列化
m = serializer.Deserialize<Menpiao>(tmp);
异常详细信息: System.ArgumentException: 无效的 JSON 基元: 。
源错误:
行 28: string result = serializer.Serialize(tmp);
行 29: //JSON反序列化
行 30: m = serializer.Deserialize<Menpiao>(tmp);
求大神指点迷津,不胜感激 asp.net JSON PHP
[解决办法]
一个个接收,或者用调用接收集合
Request["title"]
Request["summary"]
....
foreach(string key in Request.Form.AllKeys)
{
Request.Form[key]
}
[解决办法]
PHP JSON 序列化的不是一个实体类所以C#无法解成实体类。
只能当成数据项来提取
[解决办法]
时间格式感觉有点问题:"expire_time":"1383062400",要简单测试一下 可以序列化过来不
[解决办法]
没弄过,帮顶下
[解决办法]
路过
[解决办法]
json和你的实体类不对应吧