title: Json.Net Resolving Property Names Properly
body: <p>I am getting some data that looks like below JSON from an API</p>
  
  <pre><code>{
      body_html: "&lt;h1&gt;Test&lt;/h1&gt;",
      id: "cu1bpkz",
      link_id: "d3_3kkgis",
      author: "jdoe",
      author_flair_text: null,
      author_flair_css_class: null,
      parent_id: "t3_3kkgis",
      body: "Test",
      subreddit_id: "q5_39vkz",
      created_utc: 1442108087,
      subreddit: "test"
  }
  </code></pre>
  
  <p>And here is my Strongly-typed class that I use for deserialization:</p>
  
  <pre><code>public class Comment
  {
      public string AuthorFlairText { get; set; }
      public string AuthorFlairCssClass { get; set; }
      public string Author { get; set; }
      public string LinkId { get; set; }
      public string Id { get; set; }
      public string BodyHtml { get; set; }
      public string Url { get; set; }
      public string SubredditId { get; set; }
      public string Subreddit { get; set; }
      public long CreatedUtc { get; set; }
      public string Body { get; set; }
      public string ParentId { get; set; }
  }
  </code></pre>
  
  <p>This is my resolver for resolving the property names:</p>
  
  <pre><code>public class ApiContractResolver : DefaultContractResolver
      {
          protected override string ResolvePropertyName(string propertyName)
          {
              var parts = propertyName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
              return parts.Select(x =&gt; char.ToUpper(x[0]) + x.Substring(1)).Aggregate((curr, next) =&gt; curr + next);
          }
      }
  </code></pre>
  
  <p>This is how I deserializing my JSON and it does not work.</p>
  
  <pre><code>var settings = new JsonSerializerSettings { ContractResolver = new ApiContractResolver() };
  var obj = JsonConvert.DeserializeObject&lt;Comment&gt;(json, settings);
  </code></pre>
  
  <p>While simple properties like body and id get properly converted, more complex properties with _ in the prop name do not. What am I missing?</p>