我想反序列化一些JSON到列表使用JSON.NET;然而,有一個數字的方式:反序列化JSON與數字行
這裏是JSON:
"payment_info": {
"fb_id": "",
"order_items": {
"0": {
"product_id": "4534",
"type": "product",
"shipping_cost_per_item": "1.00",
"quantity": "3",
"price_each": "10.00",
"price_total": "30.00"
}
},
這裏是我的類:
public class OrderItem
{
public string product_id { get; set; }
public string type { get; set; }
public string shipping_cost_per_item { get; set; }
public string quantity { get; set; }
public string price_each { get; set; }
public string price_total { get; set; }
}
public class OrderItems
{
public List<OrderItem> Items { get; set; }
}
我如何告訴轉換器忽略0?每個訂單項目將有1,2,3個。