title: Can't access JSON object
body: <p>I am using asp mvc and am returning a json object to my view, and I cannot seem to access any of the properties in the json. Here is my code.</p>
  
  <p>In my Model I have:</p>
  
  <pre><code>public string getJson()
  { 
      File a = new File();
      a.Name = "matt";
      a.Path = "c:/adsgadsg/sdagdsag";
      string json = new JavaScriptSerializer().Serialize(a);
      //json = "{\"Name\":\"matt\",\"Path\":\"c:/adsgadsg/sdagdsag\"}"   
      return json;
  }
  </code></pre>
  
  <p>Then in my javascript I have:</p>
  
  <pre><code>function test() {
      var userRegion = '@Model.getJson()';
      var tmp = userRegion.Name;
      var tmp2 = userRegion[0].Name;
      alert(tmp);//undefined
      alert(tmp2);//undefined
  }
  </code></pre>
  
  <p>What am I doing wrong? thanks.</p>
  
  <p><strong>EDIT:</strong>
  When I am debugging the javascript, I notice that  '@Model.getJson()'; gets converted to a weird string that CANNOT be parsed by JSON.parse without an exception.</p>
  
  <pre><code> var userRegion = JSON.parse('{&amp;quot;Name&amp;quot;:&amp;quot;matt&amp;quot;,&amp;quot;Path&amp;quot;:&amp;quot;c:/adsgadsg/sdagdsag&amp;quot;}');
  </code></pre>
  
  <p>Causes the exception <strong>Uncaught SyntaxError: Unexpected token &amp;</strong></p>