.net core使用JsonResult返回时中文被编码
Startup.cs添加两个引用
using System.Text.Unicode;
using System.Text.Encodings.Web;
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews().AddJsonOptions(op => op.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All));
}
services添加红色部分代码
亲测有效