Using StringEscapeHandling.EscapeNonAscii with Json.NET

前端 未结 2 600
清酒与你
清酒与你 2020-12-12 02:39

The latest release of Json.NET (4.5.11) contains StringEscapeHandling.EscapeNonAscii, which escapes all non ASCII chars. But, I can\'t figure out where to pass it as a para

相关标签:
2条回答
  • 2020-12-12 03:14

    Based on the documentation, this property is only available on JsonWriter and its inheritors.

    0 讨论(0)
  • 2020-12-12 03:20

    On more recent versions of Newtonsoft.Json this is available on JsonConvert.SerializeObject(). Pass a JsonSerializerSettings instance where StringEscapeHandling is StringEscapeHandling.EscapeNonAscii.

    0 讨论(0)
提交回复
热议问题