0
我試圖從這個JSON字符串數據Link點擊鏈接查看解析來自網絡鏈接的JSON結果
使用JSON.NET。我能夠反序列化和串整個事情。但我需要的只是下面
"Warranty":[
{
"EndDate": "ValueIWant",
"ServiceLevelDescription": "ValueIWant"
},
應該是由有我需要的結束日期& ServiceLevelDescription所有,並在多行文本框列出這4項保證值。
編輯:最後的工作代碼
string Serial = "G88NJX1";
WebClient client = new WebClient();
Stream stream = client.OpenRead("https://api.dell.com/support/v2/assetinfo/warranty/tags.json?svctags=" + Serial + "&apikey=1adecee8a60444738f280aad1cd87d0e");
StreamReader reader = new StreamReader(stream);
var jObject = JObject.Parse(reader.ReadLine());
foreach (var o in jObject["GetAssetWarrantyResponse"]["GetAssetWarrantyResult"]["Response"]["DellAsset"]["Warranties"]["Warranty"])
{
Console.WriteLine("Warranty end date: {0}", (string)o["EndDate"]);
Console.WriteLine("Warranty service level description: {0}", (string)o["ServiceLevelDescription"]);
}
Console.ReadLine();
stream.Close();
我不想爲此使用服務參考。 –