Serializing strings containing apostrophes with JSON.Net

后端 未结 4 1115
我在风中等你
我在风中等你 2020-12-03 10:47

I am using JSON.Net as my serializer for a large MVC 3 web application in c# and the Razor view engine. For the initial page load in one view, there is a large amount of JSO

4条回答
  •  有刺的猬
    2020-12-03 11:04

    JsonSerializerSettings settings = new JsonSerializerSettings
    {
        StringEscapeHandling = StringEscapeHandling.EscapeHtml
    };
    
    JsonConvert.SerializeObject(obj, settings);
    

提交回复
热议问题