title: JavaScriptSerializer - JSON serialization of enum as string
body: <p>I have a class that contains an <code>enum</code> property, and upon serializing the object using <code>JavaScriptSerializer</code>, my json result contains the integer value of the enumeration rather than its <code>string</code> &quot;name&quot;.  Is there a way to get the enum as a <code>string</code> in my json without having to create a custom <code>JavaScriptConverter</code>?  Perhaps there's an attribute that I could decorate the <code>enum</code> definition, or object property, with?</p>
  <p>As an example:</p>
  <pre><code>enum Gender { Male, Female }
  
  class Person
  {
      int Age { get; set; }
      Gender Gender { get; set; }
  }
  </code></pre>
  <p>Desired JSON result:</p>
  <pre><code>{ &quot;Age&quot;: 35, &quot;Gender&quot;: &quot;Male&quot; }
  </code></pre>
  <p>Ideally looking for answer with built-in .NET framework classes, if not possible alternatives (like Json.net) are welcome.</p>