0
我似乎無法正確映射此json網頁的類。將JSON int打印到文本框中
using (var webClient = new System.Net.WebClient())
{
var json = webClient.DownloadString(@"https://opskins.com/api/user_api.php?request=GetLowestSalePrices&key=bac6e59d7edf4be1529adf53a1a5f8&appid=295110&contextid=1&names=Skin:+Graffiti+Hunting+Rifle");
var jsonData = JsonConvert.DeserializeObject<Items>(json);
richTextBox1.Text = jsonData.SkinGraffitiHuntingRifle.ToString();
}
}
{"result":{"appid":295110,"contextid":1,"items":{"Skin: Graffiti Hunting Rifle":11990}}}
類:
public class Rootobject
{
public Result result { get; set; }
}
public class Result
{
public int appid { get; set; }
public int contextid { get; set; }
public Items items { get; set; }
}
public class Items
{
public int SkinGraffitiHuntingRifle { get; set; }
}
}
我不能打印出皮膚的價值:塗鴉獵槍到文本框,返回的字符串是0,因爲我沒有正確映射。