title: Fail to serialize IConfigurationSection from Json
body: <p>I have following Json-based configuration file:</p>
  
  <pre><code>{
    "PostProcessing": {
      "ValidationHandlerConfiguration": {
        "MinimumTrustLevel": 80,
        "MinimumMatchingTrustLevel": 75
      },
      "MatchingCharacterRemovals": [
        "-",
        "''",
        ":"
      ]
    },
    "Processing": {
      "OrderSelection": {
        "SelectionDaysInterval": 30,
        "SelectionDaysMaximum": 365
      }
    }
  }
  </code></pre>
  
  <p>As serialization framework I use <strong>Newtonsoft</strong>. To serialize this config into objects I have implemented following classes:</p>
  
  <pre><code>[JsonObject(MemberSerialization.OptIn)]
  public class RecognitionConfiguration {
      [JsonProperty(PropertyName = "PostProcessing", Required = Required.Always)]
      public PostRecognitionConfiguration PostRecognitionConfiguration { get; set; }
  
      [JsonProperty(PropertyName = "Processing", Required = Required.Always)]
      public ProcessRecognitionConfiguration ProcessRecognitionConfiguration { get; set; }
  }
  
  [JsonObject(MemberSerialization.OptIn)]
  public class PostRecognitionConfiguration {
      [JsonProperty(Required = Required.Always)]
      public ValidationHandlerConfiguration ValidationHandlerConfiguration { get; set; }
  
      [JsonProperty] public List&lt;string&gt; MatchingCharacterRemovals { get; set; }
  }
  
  [JsonObject(MemberSerialization.OptIn)]
  public class ProcessRecognitionConfiguration {
      [JsonProperty(PropertyName = "OrderSelection", Required = Required.Always)]
      public OrderSelectionConfiguration OrderSelectionConfiguration { get; set; }
  }
  </code></pre>
  
  <p>In a class I try to serialize a specific configuration section into these class structures using <strong>IConfigurationSection.Get()</strong>. </p>
  
  <pre><code>var serializedConfiguration = this.ConfigurationSection.Get&lt;RecognitionConfiguration&gt;();
  </code></pre>
  
  <p>But when I debug the code, I always get an "empty" variable <strong>serializedConfiguration</strong> which is not null, but all properties are null. </p>
  
  <p><a href="https://i.stack.imgur.com/HKNGC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HKNGC.png" alt="enter image description here"></a></p>
  
  <p>If I use </p>
  
  <pre><code>this.ConfigurationSection.GetSection("Processing").Get&lt;ProcessRecognitionConfiguration&gt;()
  </code></pre>
  
  <p>or change the naming of the properties in the json file to exactly match the property names in the classes like this:</p>
  
  <pre><code>{   
    "ProcessRecognitionConfiguration": {
      "OrderSelectionConfiguration": {
        "SelectionDaysInterval": 30,
        "SelectionDaysMaximum": 365
      }
    }
  }
  </code></pre>
  
  <p>it it works fine. Do you have any idea, why setting <strong>PropertyName</strong> on <strong>JsonProperty</strong> does not seem to have any effect?</p>