http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 3949|回复: 5

[求助] 有劳站长帮我看下这个json

[复制链接]
发表于 2014-12-25 21:05:18 | 显示全部楼层 |阅读模式
[Java] 纯文本查看 复制代码
{
	"Currency": 0,
	"Step": "New",
	"Packages": [[{
		"Transport": 0,
		"LyId": "0",
		"No": "",
		"RouteType": 11,
		"Channel": 1,
		"RouteArea": 1,
		"Id": "525119",
		"Type": "",
		"IsDiscount": true,
		"DepartureTime": "2014-12-26 07:20:00",
		"Departure": "",
		"DepartureStation": "",
		"DepartureCode": "",
		"ArrivalTime": "2014-12-26 09:55:00",
		"Arrival": "",
		"ArrivalStation": "",
		"ArrivalCode": "",
		"Bus": false,
		"IsReturn": false,
		"Stopovers": [],
		"CabinInfos": [{
			"CabinLevel": 0,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "X",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 720,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": [{
					"Must": false,
					"ProductCompanyId": 0,
					"ProductId": 25,
					"ProductName": "",
					"ProductNum": 1,
					"ProductMaxNum": 1,
					"ProductPrice": 0,
					"ProductType": 7,
					"ProductCategory": null,
					"ProductInfo": "1058886",
					"AllProductInfo": ""
					"Discount": 0,
					"SeatId": null,
					"SeatNo": null,
					"Selected": false,
					"DownLoadLink": null,
					"IncreaseProductOrderDetailId": null,
					"PaymentStatus": 0
				}]
			}]
		},
		{
			"CabinLevel": 1,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "E",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 580,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": []
			}]
		},
		{
			"CabinLevel": 2,
			"Cabins": []
		}],
		"SWCabinInfos": []
	}],
	[{
		"Transport": 0,
		"LyId": "0",
		"No": "",
		"RouteType": 11,
		"Channel": 1,
		"RouteArea": 1,
		"Id": "547295",
		"Type": "",
		"IsDiscount": true,
		"DepartureTime": "2014-12-26 09:25:00",
		"Departure": "",
		"DepartureStation": "",
		"DepartureCode": "",
		"ArrivalTime": "2014-12-26 11:55:00",
		"Arrival": "",
		"ArrivalStation": "",
		"ArrivalCode": "",
		"Bus": false,
		"IsReturn": false,
		"Stopovers": [],
		"CabinInfos": [{
			"CabinLevel": 0,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "X",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 720,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": [{
					"Must": false,
					"ProductCompanyId": 0,
					"ProductId": 25,
					"ProductName": "",
					"ProductNum": 1,
					"ProductMaxNum": 1,
					"ProductPrice": 0,
					"ProductType": 7,
					"ProductCategory": null,
					"ProductInfo": "1134245",
					"AllProductInfo": ""
					"Discount": 0,
					"SeatId": null,
					"SeatNo": null,
					"Selected": false,
					"DownLoadLink": null,
					"IncreaseProductOrderDetailId": null,
					"PaymentStatus": 0
				}]
			}]
		},
		{
			"CabinLevel": 1,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "E",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 580,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": []
			}]
		},
		{
			"CabinLevel": 2,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "R2",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 440,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": []
			}]
		}],
		"SWCabinInfos": []
	}],
	[{
		"Transport": 0,
		"LyId": "0",
		"No": "",
		"RouteType": 11,
		"Channel": 1,
		"RouteArea": 1,
		"Id": "524679",
		"Type": "",
		"IsDiscount": true,
		"DepartureTime": "2014-12-26 13:10:00",
		"Departure": "",
		"DepartureStation": "",
		"DepartureCode": "",
		"ArrivalTime": "2014-12-26 15:45:00",
		"Arrival": "",
		"ArrivalStation": "",
		"ArrivalCode": "",
		"Bus": false,
		"IsReturn": false,
		"Stopovers": [],
		"CabinInfos": [{
			"CabinLevel": 0,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "X",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 720,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": [{
					"Must": false,
					"ProductCompanyId": 0,
					"ProductId": 25,
					"ProductName": "",
					"ProductNum": 1,
					"ProductMaxNum": 1,
					"ProductPrice": 0,
					"ProductType": 7,
					"ProductCategory": null,
					"ProductInfo": "1057192",
					"AllProductInfo": ""
					"Discount": 0,
					"SeatId": null,
					"SeatNo": null,
					"Selected": false,
					"DownLoadLink": null,
					"IncreaseProductOrderDetailId": null,
					"PaymentStatus": 0
				}]
			}]
		},
		{
			"CabinLevel": 1,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "X",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 720,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": []
			}]
		},
		{
			"CabinLevel": 2,
			"Cabins": []
		}],
		"SWCabinInfos": []
	}],
	[{
		"Transport": 0,
		"LyId": "0",
		"No": "",
		"RouteType": 11,
		"Channel": 1,
		"RouteArea": 1,
		"Id": "524371",
		"Type": "",
		"IsDiscount": true,
		"DepartureTime": "2014-12-26 17:10:00",
		"Departure": "",
		"DepartureStation": "",
		"DepartureCode": "",
		"ArrivalTime": "2014-12-26 19:40:00",
		"Arrival": "",
		"ArrivalStation": "",
		"ArrivalCode": "",
		"Bus": false,
		"IsReturn": false,
		"Stopovers": [],
		"CabinInfos": [{
			"CabinLevel": 0,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "X",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 720,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": [{
					"Must": false,
					"ProductCompanyId": 0,
					"ProductId": 25,
					"ProductName": "",
					"ProductNum": 1,
					"ProductMaxNum": 1,
					"ProductPrice": 0,
					"ProductType": 7,
					"ProductCategory": null,
					"ProductInfo": "1055498",
					"AllProductInfo": "",
					"Discount": 0,
					"SeatId": null,
					"SeatNo": null,
					"Selected": false,
					"DownLoadLink": null,
					"IncreaseProductOrderDetailId": null,
					"PaymentStatus": 0
				}]
			}]
		},
		{
			"CabinLevel": 1,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "E",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 580,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": []
			}]
		},
		{
			"CabinLevel": 2,
			"Cabins": []
		}],
		"SWCabinInfos": []
	}],
	[{
		"Transport": 0,
		"LyId": "0",
		"No": "9C8955",
		"RouteType": 11,
		"Channel": 1,
		"RouteArea": 1,
		"Id": "533677",
		"Type": "A320",
		"IsDiscount": true,
		"DepartureTime": "2014-12-26 21:40:00",
		"Departure": "",
		"DepartureStation": "",
		"DepartureCode": "",
		"ArrivalTime": "2014-12-27 00:25:00",
		"Arrival": "",
		"ArrivalStation": "",
		"ArrivalCode": "",
		"Bus": false,
		"IsReturn": false,
		"Stopovers": [],
		"CabinInfos": [{
			"CabinLevel": 0,
			"Cabins": []
		},
		{
			"CabinLevel": 1,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "E",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 580,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": []
			}]
		},
		{
			"CabinLevel": 2,
			"Cabins": [{
				"CabinId": null,
				"CabinIntegral": 0,
				"CabinName": "R2",
				"CabinRemain": 0,
				"TotalLimit": 0,
				"CabinType": 0,
				"CabinPrice": 440,
				"CabinPricing": 0,
				"AirPortFee": 0,
				"FuelFee": 0,
				"OtherFee": 0,
				"CabinBaggage": 0,
				"Products": []
			}]
		}],
		"SWCabinInfos": []
	}]],
	"IfSuccess": "Y",
	"Code": "0",
	"MaxDiscountAmount": null,
	"MaxDiscountRate": null,
	"OtherInfo": null,
	"TargetId": null,
	"CustomText": null
}



这是JSON的数据

我建了以下几个类!但是就是解析不出数据,你看是哪里错了!
[C#] 纯文本查看 复制代码
public class Cabin
    {
        public string CabinId { get; set; }
        public string CabinIntegral { get; set; }
        public string CabinName { get; set; }
        public string CabinRemain { get; set; }
        public string TotalLimit { get; set; }
        public string CabinType { get; set; }
        public string CabinPrice { get; set; }
        public string CabinPricing { get; set; }
        public string AirPortFee { get; set; }
        public string FuelFee { get; set; }
        public string OtherFee { get; set; }
        public string CabinBaggage { get; set; }
        public string Products { get; set; }
    }



[C#] 纯文本查看 复制代码
public class CabinInfo
    {
        public string CabinLevel { get; set; }
        public Cabin Cabins { get; set; }
    }


[C#] 纯文本查看 复制代码
 public class Package
    {
        public string Transport { get; set; }
        public string LyId { get; set; }
        public string No { get; set; }
        public string RouteType { get; set; }
        public string Channel { get; set; }
        public string RouteArea { get; set; }
        public string Id { get; set; }
        public string Type { get; set; }
        public string IsDiscount { get; set; }
        public string DepartureTime { get; set; }
        public string Departure { get; set; }
        public string DepartureStation { get; set; }
        public string DepartureCode { get; set; }
        public string ArrivalTime { get; set; }
        public string Arrival { get; set; }
        public string ArrivalStation { get; set; }
        public string ArrivalCode { get; set; }
        public string Bus { get; set; }
        public string IsReturn { get; set; }
        public string Stopovers { get; set; }
        public CabinInfo CabinInfos { get; set; }
    }



[C#] 纯文本查看 复制代码
 public class One
    {
        public string Currency { get; set; }
        public string Step { get; set; }
        public Package Packages { get; set; }
        public string IfSuccess { get; set; }
        public string Code { get; set; }
        public string MaxDiscountAmount { get; set; }
        public string MaxDiscountRate { get; set; }
        public string OtherInfo { get; set; }
        public string TargetId { get; set; }
        public string CustomText { get; set; }
    }



[C#] 纯文本查看 复制代码
List<One> one = (List<One>)HttpHelper.HttpHelper.JsonToObject<List<One>>(str);
            MessageBox.Show(one.Count.ToString());


有劳站长的!新手!给您添麻烦了!


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
 楼主| 发表于 2014-12-25 21:05:47 | 显示全部楼层
类我都是按照上面的数据一点点排出来的!
 楼主| 发表于 2014-12-25 21:05:52 | 显示全部楼层
类我都是按照上面的数据一点点排出来的!
 楼主| 发表于 2014-12-25 21:09:38 | 显示全部楼层
Products  第一次出现时里面的数据我都过滤过了!跟下面的显示的都一样!没有数据
发表于 2014-12-26 08:31:11 | 显示全部楼层
Json字符串不完整吧
 楼主| 发表于 2014-12-26 13:33:57 | 显示全部楼层
这是抓出来的源数据!没改过哦!
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-12-20 02:25

© 2014-2021

快速回复 返回顶部 返回列表