净 C#。我正在尝试从 Web 服务中解析 Json。我已经用文本完成了它,但解析图像有问题。这是我从中获取 Json 的网址
http://collectionking.com/rest/view/items_in_collection.json?args=122
这是我解析它的代码
using (var wc = new WebClient()) {
JavaScriptSerializer js = new JavaScriptSerializer();
var result = js.Deserialize<ck[]>(wc.DownloadString("http://collectionking.com/rest/view/items_in_collection.json args=122"));
foreach (var i in result) {
lblTitle.Text = i.node_title;
imgCk.ImageUrl = i.["main image"];
lblNid.Text = i.nid;
任何帮助都会很棒。提前致谢。PS:它返回标题和 Nid 但不返回图像。我的班级如下:
public class ck
{
public string node_title;
public string main_image;
public string nid; }