我正在尝试将一段 JSON 反序列化为 C# 对象,但到目前为止收效甚微。根据http://jsonlint.com/,以下字符串是有效的 JSON。但是,其中似乎没有任何变量名称。我习惯于看到带有“objectID”、“objectName”等字符串的 JSON。在这种情况下,我可以创建一个带有 objectID 和 objectName 等字段的 C# 对象,然后像这样反序列化整个内容:
Quote deserializedProduct = JsonConvert.DeserializeObject<Product>(json);
关于我如何做到这一点的任何建议?例如,我看不到它只会反序列化为一系列锯齿状或嵌套数组的方法。将不胜感激任何帮助。
{
"ABCXYZ": {
"Wed, Aug 29|Wed|29 Aug 12": [
[
"0~W~W4LOW~BND4~~1~X",
"FR~ 812~ ~~ABC~08/29/2012 06:35~XYZ~08/29/2012 07:45~",
"No Taxes",
"2012-08-29 06:35",
"2012-08-29 07:45",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 11.74
}
]
}
],
-1,
0,
0,
0
],
[
"0~W~W4LOW~BND4~~1~X",
"FR~ 816~ ~~ABC~08/29/2012 14:55~XYZ~08/29/2012 16:05~",
"No Taxes",
"2012-08-29 14:55",
"2012-08-29 16:05",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 11.74
}
]
}
],
-1,
0,
0,
0
],
[
"0~W~W4LOW~BND4~~1~X",
"FR~ 818~ ~~ABC~08/29/2012 19:50~XYZ~08/29/2012 20:55~",
"No Taxes",
"2012-08-29 19:50",
"2012-08-29 20:55",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 11.74
}
]
}
],
-1,
0,
0,
0
]
],
"Thu, Aug 30|Thu|30 Aug 12": [
[
"0~W~W4LOW~BND4~~1~X",
"FR~ 812~ ~~ABC~08/30/2012 06:35~XYZ~08/30/2012 07:45~",
"No Taxes",
"2012-08-30 06:35",
"2012-08-30 07:45",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 11.74
}
]
}
],
-1,
0,
0,
0
],
[
"0~W~W4LOW~BND4~~1~X",
"FR~ 816~ ~~ABC~08/30/2012 08:30~XYZ~08/30/2012 09:40~",
"No Taxes",
"2012-08-30 08:30",
"2012-08-30 09:40",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 11.74
}
]
}
],
-1,
0,
0,
0
],
[
"0~W~W4LOW~BND4~~1~X",
"FR~ 818~ ~~ABC~08/30/2012 22:10~XYZ~08/30/2012 23:15~",
"No Taxes",
"2012-08-30 22:10",
"2012-08-30 23:15",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 11.74
}
]
}
],
-1,
0,
0,
0
]
],
"Fri, Aug 31|Fri|31 Aug 12": [
[
"0~W~W4LOW~BND4~~1~X",
"FR~ 812~ ~~ABC~08/31/2012 06:35~XYZ~08/31/2012 07:45~",
"No Taxes",
"2012-08-31 06:35",
"2012-08-31 07:45",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 11.74
}
]
}
],
-1,
0,
0,
0
],
[
"0~C~C4LOW~BND4~~1~X",
"FR~ 816~ ~~ABC~08/31/2012 13:20~XYZ~08/31/2012 14:30~",
"No Taxes",
"2012-08-31 13:20",
"2012-08-31 14:30",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 32.74
}
]
}
],
2,
0,
0,
0
],
[
"0~C~C4LOW~BND4~~1~X",
"FR~ 818~ ~~ABC~08/31/2012 19:50~XYZ~08/31/2012 20:55~",
"No Taxes",
"2012-08-31 19:50",
"2012-08-31 20:55",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 32.74
}
]
}
],
3,
0,
0,
0
]
],
"Sat, Sep 01|Sat|01 Sep 12": [
[
"0~C~C4LOW~BND4~~1~X",
"FR~ 812~ ~~ABC~09/01/2012 08:05~XYZ~09/01/2012 09:15~",
"No Taxes",
"2012-09-01 08:05",
"2012-09-01 09:15",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 32.74
}
]
}
],
-1,
0,
0,
0
],
[
"0~W~W4LOW~BND4~~1~X",
"FR~ 818~ ~~ABC~09/01/2012 17:00~XYZ~09/01/2012 18:05~",
"No Taxes",
"2012-09-01 17:00",
"2012-09-01 18:05",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 11.74
}
]
}
],
2,
0,
0,
0
]
],
"Sun, Sep 02|Sun|02 Sep 12": [
[
"0~N~N16SEP~FCCG~~3~X",
"FR~ 812~ ~~ABC~09/02/2012 06:35~XYZ~09/02/2012 07:45~",
"No Taxes",
"2012-09-02 06:35",
"2012-09-02 07:45",
[
{
"ADT": [
1,
"0.00",
"0",
{
"WC": 6,
"ETS": 0.25,
"FarePrice": 9.75
}
]
}
],
-1,
0,
0,
0
],
[
"0~H~H4LOW~BND4~~1~X",
"FR~ 816~ ~~ABC~09/02/2012 14:55~XYZ~09/02/2012 16:05~",
"No Taxes",
"2012-09-02 14:55",
"2012-09-02 16:05",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 23.74
}
]
}
],
1,
0,
0,
0
],
[
"0~K~K4LOW~BND4~~1~X",
"FR~ 818~ ~~ABC~09/02/2012 20:25~XYZ~09/02/2012 21:30~",
"Regular Fare",
"2012-09-02 20:25",
"2012-09-02 21:30",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"Tax": 36,
"FarePrice": 33.99
}
]
}
],
-1,
0,
0,
0
]
],
"Mon, Sep 03|Mon|03 Sep 12": [
[
"0~N~N16SEP~FCCG~~3~X",
"FR~ 812~ ~~ABC~09/03/2012 06:35~XYZ~09/03/2012 07:45~",
"No Taxes",
"2012-09-03 06:35",
"2012-09-03 07:45",
[
{
"ADT": [
1,
"0.00",
"0",
{
"WC": 6,
"ETS": 0.25,
"FarePrice": 9.75
}
]
}
],
-1,
0,
0,
0
],
[
"0~A~A4LOW~BND4~~1~X",
"FR~ 818~ ~~ABC~09/03/2012 14:35~XYZ~09/03/2012 15:40~",
"No Taxes",
"2012-09-03 14:35",
"2012-09-03 15:40",
[
{
"ADT": [
1,
"0.00",
"0",
{
"CANX": 2,
"WC": 6,
"ETS": 0.25,
"FarePrice": 17.74
}
]
}
],
-1,
0,
0,
0
],
[
"0~N~N16SEP~FCCG~~3~X",
"FR~ 816~ ~~ABC~09/03/2012 22:55~XYZ~09/03/2012 23:59~",
"No Taxes",
"2012-09-03 22:55",
"2012-09-03 23:59",
[
{
"ADT": [
1,
"0.00",
"0",
{
"WC": 6,
"ETS": 0.25,
"FarePrice": 9.75
}
]
}
],
3,
0,
0,
0
]
],
"Tue, Sep 04|Tue|04 Sep 12": [
[
"0~N~N16SEP~FCCG~~3~X",
"FR~ 812~ ~~ABC~09/04/2012 06:35~XYZ~09/04/2012 07:45~",
"No Taxes",
"2012-09-04 06:35",
"2012-09-04 07:45",
[
{
"ADT": [
1,
"0.00",
"0",
{
"WC": 6,
"ETS": 0.25,
"FarePrice": 9.75
}
]
}
],
-1,
0,
0,
0
],
[
"0~N~N16SEP~FCCG~~3~X",
"FR~ 818~ ~~ABC~09/04/2012 19:50~XYZ~09/04/2012 20:55~",
"No Taxes",
"2012-09-04 19:50",
"2012-09-04 20:55",
[
{
"ADT": [
1,
"0.00",
"0",
{
"WC": 6,
"ETS": 0.25,
"FarePrice": 9.75
}
]
}
],
-1,
0,
0,
0
]
]
}
}