我正在尝试使用Razor将对象作为JSON编写到我的Asp.Net MVC View中,如下所示:
<script type="text/javascript">
var potentialAttendees = @Json.Encode(Model.PotentialAttendees);
</script>
Run Code Online (Sandbox Code Playgroud)
问题是在输出中JSON被编码,我的浏览器不喜欢它.例如:
<script type="text/javascript">
var potentialAttendees = [{"Name":"Samuel Jack"},];
</script>
Run Code Online (Sandbox Code Playgroud)
如何让Razor发出未编码的JSON?