title: Json.Net Rename properties during serialization
body: <p>I have a library I'm interfacing with which I have absolutely no control over.  The objects are formatted with property names like this:</p>
  
  <pre><code>{"my property": "my value"}
  </code></pre>
  
  <p>and</p>
  
  <pre><code>{"my-property": "my value"}
  </code></pre>
  
  <p>Using json.net I can add an attribute to the properties in the class that represents each message to map those property names to a property in my class:</p>
  
  <pre><code>public class MyClass
  {
    [JsonProperty(PropertyName="my-prop")]
    public String MyProperty {get; set;}
  }
  </code></pre>
  
  <p>This is fine, but the issue is that I have to use these 'magic strings' on a large number  of classes and I really despise magic strings.</p>
  
  <p>The bottom line:</p>
  
  <p>Is there any way to change all of these properties into a C# readable string so as to have json.net map those properties automatically?</p>
  
  <p>i.e.:</p>
  
  <pre><code>{"my property": "my value"}
  </code></pre>
  
  <p>Should change to:</p>
  
  <pre><code>{"MyProperty": "my value"}
  </code></pre>
  
  <p>During deserialization, which would then flow that value to the MyProperty member in MyClass without annotating the property with a hard coded string value.</p>