title: JSON convert JsonResult to javascript string without encoding quotations
body: <p>I need to convert a <code>Microsoft.AspNet.Mvc.Controller.JsonResult</code> to a string using <code>ASP.NET Core</code></p>
  
  <p>Here is my code in ASP.NET MVC</p>
  
  <pre><code>public async Task&lt;string&gt; GetJsonData()
  {
      //...
      var result = GetMyComplexObject();
  
      //using Newtonsoft.Json.JsonConvert method
      var jsonString = JsonConvert.SerializeObject(Json(result));
      return jsonString;
  }
  
  public async Task&lt;IActionResult&gt; Index()
  {
      var myViewModel= new MyViewModel();
      myViewModel.JsonString = GetJsonData();
      return View(myViewModel);
  }
  
  public class MyViewModel
  {
      //...
      public string JsonString { get; set; }
  }
  </code></pre>
  
  <p>and in my cshtml</p>
  
  <pre><code>var dataSet = {@(Model.JsonString))};
  </code></pre>
  
  <p>However in the generated source instead of the fields being in quotations, they are html encoded  e.g. <code>&amp;quot;field1&amp;quot;</code> </p>
  
  <p>Instead of running string replaces is there not a neater way to convert a <code>JsonResult</code> to <code>string</code></p>