title: appsettings.json in .netCore console application
body: <p>I have an appsettings.json file with the following values </p>
  
  <pre><code>{ 
    "MailOptions": 
    { 
      "Username": "ruskin", 
      "Password": "password" 
    } 
  }
  </code></pre>
  
  <p>When I read it via the <code>ConfigurationBuilder</code> I can only access the values via <code>configuration["MailSettings:Username"]</code>. I want to grab the entire MailOptions string, is there anyway to do that? I don't want to use Json to parse the file etc...I want to stick to configuration builder.</p>
  
  <p>I would expect <code>configuration.GetSection("MailOptions")</code> to work? It simply returns <code>null</code>.</p>
  
  <p><strong>What I have tried</strong></p>
  
  <pre><code>SomeSection aSection = new SomeSection();
  ServiceCollection serviceCollection = new ServiceCollection();
  serviceCollection.Configure&lt;SomeSection&gt;(options =&gt; configuration.GetSection("SomeSection").Bind(aSection));
  var someSection = serviceCollection.BuildServiceProvider().GetService&lt;IOptions&lt;SomeSection&gt;&gt;();
  
  // aSection is instantiated but no values in it
  // someSection is null
  </code></pre>
  
  <p>My appsettings.json</p>
  
  <pre><code>{
    "SomeSection": {
      "UserName": "ruskin",
      "Password": "dantra" 
    }
  }
  </code></pre>
  
  <p>And my POCO class</p>
  
  <pre><code>public class SomeSection
  {
      public string UserName { get; set; }
      public string Password { get; set; }
  }
  </code></pre>