title: ASP.NET MVC 3 Serializing to JSON
body: <p>I've got an <code>ICollection&lt;T&gt;</code> of POCO like this:</p>
  
  <pre><code>public class SearchJsonModel
  {
     public string label { get; set; }
     public string category { get; }
  }
  </code></pre>
  
  <p>In my Razor view, i serialize it as follows:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
     var jsonArray = @Html.Raw(Json.Encode(Model));
  &lt;/script&gt;
  </code></pre>
  
  <p>But the output is this:</p>
  
  <pre><code>var jsonArray = [
     {"category":"Names","label":"Joe"},
     {"category":"Names","label":"John"}
  ];
  </code></pre>
  
  <p>Which is causing problems because of the quotes around the properties. </p>
  
  <p>I need to access the properties of each JSON object, so I would expect it to be like this:</p>
  
  <pre><code>var jsonArray = [
     {category:"Names",label:"Joe"},
     {category:"Names",label:"John"}
  ];
  </code></pre>
  
  <p>That way i can do something like this:</p>
  
  <pre><code>$.each(jsonArray, function(index, item) {
     var x = item.category;
  });
  </code></pre>
  
  <p>What am i doing wrong? Am i using the wrong method to encode?</p>