Convert C# object to JSON or Javascript object

Razor will automatically escape HTML entities for you in an attempt to be helpful. You can disable this with Html.Raw:

JSON.parse(@Html.Raw(TheString))

For your second error, JSON.parse expects a string, but you are passing in an array. Your outputted js code has to look like this to work:

var data1 = JSON.parse("[{\"Name\":\"CASE_A\",\"Values\":[99.8,99.9,98.6]},{\"Name\":\"CASE_B\",\"Values\":[96.7,11.1]}]");

I also want to note that since you are injecting this object into your javascript code on the server side, there is no need to call JSON.parse at all. As long as you send properly formatted javascript to the client where it will be evaluated and run, then it doesn't matter how it's created on the server. Try this instead:

var data1 = @Html.Raw(@tmp);

You may try this using HtmlHelper.Raw method:-

data = JSON.parse(@Html.Raw(TheString));

Also check out DataContractJsonSerializer Class

Serializes objects to the JavaScript Object Notation (JSON) and deserializes JSON data to objects. This class cannot be inherited.