title: C# - Web API - Serializing Enums as strings with spaces
body: <p>My question is simple, but a little more specific than other questions related to serializing enumerated types as strings.</p>
  
  <p>Consider the following piece of code:</p>
  
  <pre><code>using Newtonsoft.Json;
  using Newtonsoft.Json.Converters;
  
  public enum MyEnum
  {
      TypeOne,
      TypeTwo,
      TypeThree
  }
  
  public class Foo
  {
     [JsonConverter(typeof(StringEnumConverter))]
     public MyEnum Types { get; set; }
  }
  </code></pre>
  
  <p>When the Web API controller sends serialized Foo objects, they may look something like this:</p>
  
  <pre><code>{
      "Type" : "TypeTwo"
  }
  </code></pre>
  
  <p><strong>My Question:</strong> is it possible to send serialized enums as strings with spaces before each capital letter? Such a solution would produce JSON like this:</p>
  
  <pre><code>{
      "Type" : "Type Two"
  }
  </code></pre>
  
  <p>Let me know if there's any additional information needed to solve my problem. Thanks!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>It's preferable if the enums are only converted to strings with spaces while serializing them to <em>JSON</em>. I'd like to exclude spaces while using <code>MyEnum.ToString()</code> on the backend.</p>