如何反序列化此 Json 字符串上的“Items”类部分:
{
"Buddies": {
"count": 1,
"items": [
{
"id": "5099207ee4b0cfbb6a2bd4ec",
"firstName": "Foo",
"lastName": "Bar",
"image": {
"url": "",
"sizes": [
60,
120,
180,
240,
360
],
"name": "myphoto.png"
}
}
]
}
}
我原来的课程是:
public class Buddy
{
public IEnumerable<Item> Items { get; set; }
public class Item {
public string Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
但是 json 的上半部分对我来说毫无用处,我想改用这个类:
public class Buddy
{
public string Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}