title: How to properly escape braces in Razor
body: <p>Attempting to render a model object into a JSON structure via a partial, like this:</p>
  
  <pre><code>@if( Model.IsEmpty ) {
      @( Model.UseNull ? "null" : "" )
  } else {
      @{ int i = 0; }
      @foreach( var program in Model.Programs ) {
      &lt;text&gt;      
      @(++i &gt; 1 ? "," : "" )
      {
          "Id": "@program.ProgramId",
          "Title": "@Html.Js( program.Title )",
          "Url": "@Html.Js( program.Url )",
      }
      &lt;/text&gt;
      }
  }
  </code></pre>
  
  <p>The page compiler complains on the foreach line, thinking the @ symbol is redundant.  Removing it results in a compilation error on the line before.  If I enclose the entire sections of the if/else in <code>&lt;text&gt;</code> blocks, it works.</p>
  
  <p>Aside from using explicit text sections, is there a way to hint the compiler or escape the braces to avoid these errors?</p>