title: JSON configuration properties containing dashes/hyphens in .NET Core
body: <p>I have a .NET Core 2.0 project using a JSON configuration file, via the <code>Microsoft.Extensions.Configuration.Json</code> provider.</p>
  
  <p>This application is a utility application to support another application that I do not control.
  To keep consistency with that other application's configuration file format/style, multi-word setting keys use dashes between words.</p>
  
  <p>Example JSON:</p>
  
  <pre class="lang-json prettyprint-override"><code>{
      "multi-word-setting": "setting value"
  }
  </code></pre>
  
  <p>Example settings class:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class AppSettings
  {
      // Pascal casing, as is typical in C#
      public string MultiWordSetting { get; set; }
  }
  </code></pre>
  
  <p>Example application code:</p>
  
  <pre class="lang-cs prettyprint-override"><code>class Program
  {
      private static void Main ( string[ ] args )
      {
          IConfigurationBuilder configBuilder = new ConfigurationBuilder( ).SetBasePath( Environment.CurrentDirectory ).AddJsonFile( "my-settings.json", true, true );
          IConfigurationRoot configRoot = configBuilder.Build( );
          AppSettings config = new AppSettings( );
          configRoot.Bind( config );
          Console.WriteLine( config.MultiWordSetting );
      }
  }
  </code></pre>
  
  <p>However, given that hyphens are illegal in identifiers in C#, how can I follow typical C# naming conventions while also following the defined style of the application I am supporting?</p>
  
  <p>I know I can use Newtonsoft and its <code>JsonPropertyAttribute</code> to just manually deal with the json data, but I'd prefer to make this work without "external" libraries, if possible. Besides, JSON.Net is over 20x larger, and the configuration libraries handle other stuff, such as automatic reloading, binding, merging, and optional files.</p>
  
  <p>I've tried adding DataMember attributes to the properties of my class, to indicate the name of the json property, but that doesn't do the trick.</p>
  
  <p>Is there a way to do this, with the .NET Core <code>Microsoft.Extensions.Configuration.Json</code> provider?</p>