Question: I have an server side object which I am posting to the client and making it into a JSON.

I had used this approach earlier as well and it used to work fine in aspx/ascx pages.
Now I had used cshtml pages as they are supposed to be leaner then aspx/ascx but my objects are not getting created I am getting JavaScript error while making them code used.

```
var sections = <%= new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(this.ViewData.Model.Sections) %>;

```

in 

cshtml I am using this

```
var assessment = @(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(Model));

```

Am I doing something wrong ?

Answer: 
Your object is getting HTML encoded. The code below should work:

```
@Html.Raw(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(Model))

```
Try 

```
@{new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(Model);}

```