示例代码:
Product product = new Product();product.Name = "Apple";
product.ExpiryDate = new DateTime(2008, 12, 28);
product.PrICE = 3.99M;
product.Sizes = new string[] { "Small", "Medium", "Large" };string output = JsonConvert.SerializeObject(product);
//{
// "Name": "Apple",
// "ExpiryDate": "2008-12-28T00:00:00",
// "Price": 3.99,
// "Sizes": [
// "Small",
// "Medium",
// "Large"
// ]
//}Product deserializedProduct = JsonConvert.DeserializeObject(output);
发布于 2016-10-11 11:03:34 | 143 次阅读