[{\"Berth\":8,\"Name\":\"GROUP OF 8 (EIGHT)\",\"Cost\":1400.0000,\"BookingFee\":40.0000,\"Available\":true,\"ProductId\":49},{\"Berth\":6,\"Name\":\"GROUP OF 6 (SIX)\",\"Cost\":1050.0000,\"BookingFee\":30.0000,\"Available\":true,\"ProductId\":49},{\"Berth\":5,\"Name\":\"GROUP OF 5 (FIVE)\",\"Cost\":875.0000,\"BookingFee\":25.0000,\"Available\":true,\"ProductId\":49},{\"Berth\":4,\"Name\":\"GROUP OF 4 (FOUR)\",\"Cost\":700.0000,\"BookingFee\":20.0000,\"Available\":true,\"ProductId\":49},{\"Name\":\"CAMPING TICKET\",\"Cost\":135.0000,\"BookingFee\":5.0000,\"Available\":false,\"ProductId\":48},{\"Name\":\"WEEKENDER PASS\",\"Cost\":110.0000,\"BookingFee\":5.0000,\"Available\":false,\"ProductId\":50}]
而已!
编辑:
我在序列化之前将数组包装在一个对象中并在输出上运行此代码......
var prods = JsonValue.Parse(json).AsDynamic();
var productId = prods.Products[0].ProductId;
它只是说 productid 是“默认”。