title: Serializing JS Functions into JSON for a JsonResult MVC
body: <p>I am writing a backend for SlickGrid. I have an AJAX call that loads the column definitions from my MVC Controller. The controller looks like this:</p>
  
  <pre><code>Public ActionResult GetColumns(...){
      List&lt;object&gt; columns;
      foreach(var col in MyColumns){
          columns.Add(new { id = col.id, name = col.name, width = col.width});
      }
      return Json(new { columns = columns });
  }
  </code></pre>
  
  <p>One of the column attributes that slickgrid accepts is formatter, which takes a js function name.</p>
  
  <p>Unfortunately, MVC puts that name in double quotes. I need to figure out if there is a way to serialize just that one field without quotes.</p>
  
  <p>eg (this is what I want)</p>
  
  <pre><code>[{"id":1,"Name":"FirstName","width":50,"formatter":NameFormater},...]
  </code></pre>
  
  <p>vs (ths is what I am getting now)</p>
  
  <pre><code>[{"id":1,"Name":"FirstName","width":50,"formatter":"NameFormater"},...]
  </code></pre>
  
  <p>I know this isn't proper JSON Format to pass JS Code in it(Proper JS Format though). But I have a valid use case here and am trying not to add too much complexity.</p>