0
从一个RESTful API的响应返回一些JSON:提取值响应
{
"meta": {
"href": "http://localhost:54398/"
},
"busPartner": {
"href": "http://localhost:54398/BusPartner",
"rel": [
"collection"
]
},
"busPartnerType": {
"href": "http://localhost:54398/BusPartnerType",
"rel": [
"collection"
]
},
"busPartnerPossAttrib": {
"href": "http://localhost:54398/BusPartnerPossAttribs",
"rel": [
"collection"
]
}
}
我试图从中提取JSON href
值的列表。虽然我可以按照以下使用JsonTextReader
走我需要出结果列表中的数值...
IList<string> tt = new List<string>();
JsonTextReader reader = new JsonTextReader(new StringReader(response));
while (reader.Read())
{
if (reader.Value != null)
{
tt.Add(reader.TokenType + " " + reader.Value);
}
else
{
tt.Add(reader.TokenType.ToString());
}
}
...这是笨拙和繁琐。一定会有更好的办法。任何线索?
感谢这已经让我完全步入正轨与我的项目的一部分,曾直副本和过去:) –