title: RestSharp - how to influence JSON serialization (naming)?
body: <p>I am trying to talk to a REST service and I'm trying to call a <code>POST</code> method where I need to provide some data in the post body.</p>
  
  <p>I have my model class all nicely set up something like this:</p>
  
  <pre><code>public class MyRequestClass
  {
      public string ResellerId { get; set; }
      public string TransactionId { get; set; }
      ... other properties of no interest here ... 
  }
  </code></pre>
  
  <p>and I'm using RestSharp in C# to call my REST service something like this:</p>
  
  <pre><code>RestClient _client = new RestClient(someUrl);
  
  var restRequest = new RestRequest("/post-endpoint", Method.POST);
  restRequest.RequestFormat = DataFormat.Json;
  restRequest.AddHeader("Content-Type", "application/json");
  
  restRequest.AddJsonBody(request);   // of type "MyRequestClass"
  
  IRestResponse&lt;MyResponse&gt; response = _client.Execute&lt;MyResponse&gt;(restRequest);
  </code></pre>
  
  <p>Everything seemed to work fine - no exceptions are thrown. But the service responds with:</p>
  
  <blockquote>
    <p>We are experiencing problem in processing your request</p>
  </blockquote>
  
  <p>When I looked at the request JSON that's being sent, I see that all the properties are in Capitalized spelling:</p>
  
  <pre><code>{ "ResellerId":"123","TransactionId":"456" }
  </code></pre>
  
  <p>and this is causing the issue - the service excepts them in all lowercase:</p>
  
  <pre><code>{ "resellerId":"123","transactionId":"456" }
  </code></pre>
  
  <p>So I tried to decorate my C# model class with attributes:</p>
  
  <pre><code>public class MyRequestClass
  {
      [RestSharp.Serializers.SerializeAs(Name = "resellerId")]
      public string ResellerId { get; set; }
  
      [RestSharp.Serializers.SerializeAs(Name = "transactionId")]
      public string TransactionId { get; set; }
      ... other properties of no interest here ... 
  }
  </code></pre>
  
  <p>but that didn't seem to change anything - the JSON request sill has the property names in a Capitalized spelling and thus the call fails.</p>
  
  <p>How can I tell RestSharp to always use <strong>lowercase</strong> property names in the JSON generated from a C# model class?</p>