How to encode the single quote/apostrophe in JSON.NET

前端 未结 4 1502
花落未央
花落未央 2021-02-08 18:55

How to encode the \' to \\u0027 with JSON.NET?

So that the json string would look something like this:

{\"Id\":8,\"CompanyName         


        
4条回答
  •  难免孤独
    2021-02-08 19:10

    Json.NET 4.5 Release 11 added an option to control string escaping. One of the options is to escape all HTML characters which includes single quotes.

    JsonWriter.StringEscapeHandling

提交回复
热议问题