I'm just trying to get a JSON string from my controller (MVC3 using Razor syntax) into the clients browser...
In My Controller I do this with a simple object (test) that contains an int and a list.
var jasonData = new JavaScriptSerializer().Serialize(test);
ViewBag.JasonData = jasonData;
In the view I do this:
<script type="text/javascript">
var initialData = @(ViewBag.JasonData);
</script>
Visual Studio shows the data looking fine but when it ends up in the Browser it has the escaping code around all the data which is not good.
&var initialData = {"DateId":32,"Scores&quo ....
This should be easy! What am I doing wrong??
jasonorjson? I hope it's the latter.