services.AddControllers().AddNewtonsoftJson();
[HttpGet] public IActionResult Get() { var data = new { name = "John", age = 30 }; return new JsonResult(data); }
上一篇:ASP.NETCoreWebAPI如何将字符串数组作为JSON键的值传递
下一篇:Asp.netcoreWebApi升级到5.0后在POST请求不起作用。