title: Convert C# object to JSON or Javascript object
body: <p>I am a C# developer and a newbi in Javascript.
  I have one C# object and finally, in index.cshtml, I can get a string converted from the object via calling Json.Encode(obj)</p>
  
  <p>The string is:</p>
  
  <pre><code>[
      {
      "Name":"CASE_A",
      "Values":[99.8,99.9,99.9,99.8,99.8,96.3,22.3]
      },
      {
      "Name":"CASE_B",
      "Values":[99.8,99.8,99.8,96.3,22.3]
      },
  ]
  </code></pre>
  
  <p>However, when I call JSON.parse(@TheString),I got:</p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token &amp; 
  </code></pre>
  
  <p>The location of this error shows me this:</p>
  
  <pre><code>data = JSON.parse([{&amp;quot;Name&amp;quot;:&amp;quot;CASE_A&amp;quot;,&amp;quot;Values&amp;quot;:[99.8,99.9,99.9,99.8 ....
  </code></pre>
  
  <p>How can I fix this problem?</p>
  
  <hr>
  
  <p>Thank you for the answers!
  But still I got an error:</p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token o
  </code></pre>
  
  <p>For simple testing, I used this:</p>
  
  <pre><code>@{
      string tmp = "[{\"Name\":\"CASE_A\",\"Values\":[99.8,99.9,98.6]},{\"Name\":\"CASE_B\",\"Values\":[96.7,11.1]}]";
  }
  var data1 = JSON.parse(@Html.Raw(@tmp));
  </code></pre>
  
  <p>And source shows this line:</p>
  
  <pre><code>var data1 = JSON.parse([{"Name":"CASE_A","Values":[99.8,99.9,98.6]},{"Name":"CASE_B","Values":[96.7,11.1]}]);
  </code></pre>
  
  <p>I cannot see any "o" here. </p>
  
  <hr>
  
  <p>Also, for making javascript object, Travis suggested to remove the key name before serialization. But in C#, all object must have its member name. All I can think of is string manipulation. Is there any better way to do so?</p>