title: JSON Result for Highcharts Data Object in C#
body: <p>I am trying to take a List of a custom class and convert it to JSON in MVC/C#. I have used both json.encode and javascriptserializer to no avail. The json data is shown with &amp;.quot; instead of the single or double quotes. Here's what I believe is the relevant code. This data is going to be used in a highcharts application.</p>
  
  <p><strong>My Models</strong></p>
  
  <pre><code>public class DataPoint
  {
      public double? data { get; set; } //CTDI value
      public DateTime? DateOfScan { get; set; }
      public string Name { get; set; }
      public string Nmmber{ get; set; }
      public int PersonDatabaseID { get; set; }
      public string EquipmentName{ get; set; }
  }
  
  public class PlotData : List&lt;DataPoint&gt;
  {
  }
  
  public class PlotListModel : List&lt;PlotData&gt;
  {
  }
  </code></pre>
  
  <p><strong>My View</strong></p>
  
  <pre><code>foreach (PlotData pd in (PlotListModel) ViewBag.MyData)
  {
      JavaScriptSerializer js = new JavaScriptSerializer();
      var jsData1 = js.Serialize(pd);
  
      //Or use JSON.Encode
      var jsData2 = Json.Encode(pd);
  
      string divID = "container" + i;
      &lt;div id='@divID'&gt;
          &lt;script type='text/javascript'&gt;
              $(function () {
                  var chart = new Highcharts.Chart({
                      chart: {
                          renderTo: '@divID',
                          type: 'colummn'
                      },
                      title: {text: '@divID'},
                      tooltip: {
                          formatter: function () {
                              return 'Extra data: &lt;b&gt;' + this.point.Scanner + '&lt;/b&gt;';
                          }
                      },
  
                      series: [{
                          name: 'Foo',
                          data: ['@jsData1']
                      }]
                  });
              });
          &lt;/script&gt;
      &lt;/div&gt;
  
      i += 1;
  }
  
  When I look at the page source I see the data fields and values surrounded by the encoded quote value - &amp;quot;
  </code></pre>