WebAPI返回xml.json格式简单示例 using System.Net.Http.Formatting; public class TestController : ApiController { public static List<Student> list = new List<Student> { new Student { Name="张三",Age=25,Weight=153.5M }, new Student { Name="
DateTime转换成json的时候容易出现不想要的格式,在网上搜索了相关的解决方法copy如下: 参考http://www.newtonsoft.com/json/help/html/DatesInJSON.htm public class LogEntry { public string Details { get; set; } public DateTime LogDate { get; set; } } public void WriteJsonDates() {