我正在使用 Json.NET 来解析 json 字符串,但是当我尝试使用 SelectToken 时它返回 null。此外,似乎 Json.NET 将 json 字符串读取为 1 个节点
这是JSON
[
[{
"input_index":0,
"candidate_index":0,
"delivery_line_1":"124 Main St",
"last_line":"Cambridge MA 02138-5813",
"delivery_point_barcode":"021385813991",
"components":{
"primary_number":"125",
"street_name":"Main",
"street_suffix":"St",
"city_name":"Cambridge",
"state_abbreviation":"MA",
"zipcode":"02138",
"plus4_code":"5813",
"delivery_point":"99",
"delivery_point_check_digit":"1"
},
"metadata":{
"record_type":"H",
"county_fips":"25017",
"county_name":"New York",
"carrier_route":"C025",
"congressional_district":"08",
"building_default_indicator":"Y"
},
"analysis":{
"dpv_match_code":"D",
"dpv_footnotes":"AAN1",
"dpv_cmra":"N",
"dpv_vacant":"N",
"ews_match":false,
"footnotes":"A#H#N#"
}
}]
]
这是代码
JArray o = JArray.Parse(page);
string something = (string)o.SelectToken("county_name");
然而,它只是返回给我 null 并且我完全感到困惑,因为 JSON.NET 解析这个 Json 字符串有问题