JSON.net Serialize C# object to JSON Issue

前端 未结 1 567
庸人自扰
庸人自扰 2020-12-24 05:41

I am trying to serialize a C# object to JSON using JSON.net library. The issue I am having is the string being created has "\'s in it.

Below is the string re

相关标签:
1条回答
  • 2020-12-24 06:24

    Your json string is being HTML encoded. Since you're rendering the json in your view, you can use the @Html.Raw() helper to prevent it from being encoded.

    var data = { json : "@Html.Raw(JsonConvert.SerializeObject(Model))" };
    
    0 讨论(0)
提交回复
热议问题