title: Serializing a function as a parameter in json using C#
body: <p>I am trying to create the json needed to create an object in jQuery using C#. The json needed is</p>
  
  <pre><code>{
      title: 'title text',
      upperVal: 40,
      lowerVal: 5,
      mouseover: function() { return 'difference ' + (upperVal - lowerVal); }
  }
  </code></pre>
  
  <p>The first few elements were simple enough. I created a class to represent the object, JSObj, and then run this through JavascriptSerializer.Serialize()</p>
  
  <pre><code>public class JSObj {
      public string title { get; set; }
      public int upperVal { get; set; }
      public int lowerVal { get; set; }
  }
  </code></pre>
  
  <p>This works fine for the first few attributes, but I don't have a clue how to return the correct mouseover function.</p>
  
  <p>EDIT: The code provided is just sample code because the structure of the json I'm actually using is a bit more complicated. I'm using HighCharts, and one of the config options that I really need to use requires a function, even though they are not really valid json ( <a href="http://www.highcharts.com/ref/#tooltip--formatter" rel="nofollow">http://www.highcharts.com/ref/#tooltip--formatter</a> ) so unfortunately I can't avoid the problem</p>