title: C# String.Format with Curly Bracket in string
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3773857/escape-curly-brace-in-string-format">Escape curly brace &#39;{&#39; in String.Format</a>  </p>
  </blockquote>
  
  
  
  <p>c# has a String.Format method that allows you to format a string but inserting params with the tokens <code>{0}</code> <code>{1}</code></p>
  
  <p>I am trying to create a simple json string which requires curly brackets to be in the string, and so it is breaking the formatter</p>
  
  <pre><code>String.Format("{ foo:'{0}', bar:'{1}' }", foo, bar);
  </code></pre>
  
  <p>Adding an escape before the braces did not help</p>
  
  <p>Throws a exception saying my string is incorrectly formatted, anyone know how to get around this?</p>