title: How to read values from multiple json files in .Net Core?
body: <p>I want to read values from multiple json files. Getting the values from default json file but unable to read separately added json file. below is my code.</p>
  <pre><code> //Reads from endpoint-defaults.json
          var endpointDefaultsBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
                       .AddJsonFile(&quot;endpoint-defaults.json&quot;, true, true)                         
                       .AddEnvironmentVariables();
          ConfigurationEndpointDefaults = endpointDefaultsBuilder.Build();
          string signOnType = ConfigurationEndpointDefaults.GetSection(&quot;AppSettings:mastercard.mip.signOnType&quot;).Value;
         var mscdGamingList = ConfigurationEndpointDefaults.GetSection(&quot;AppSettings:paymentPostCountryProhibitionCheckStage.mscdGamingList.list&quot;).Get&lt;string[]&gt;();
  
  
          //Reads from config.json
          var configbuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
                  .AddJsonFile(&quot;jsconfig1.json&quot;, true, true)
                  .AddEnvironmentVariables();
          Configuration = configbuilder.Build();
          string environmentMode = Configuration.GetSection(&quot;AppSettings:mastercard.mip.hostname&quot;).Value;
  </code></pre>
  <p>Here is the output.
  <a href="https://i.stack.imgur.com/rJWuZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rJWuZ.png" alt="enter image description here" /></a></p>
  <p>My Json Files</p>
  <ol>
  <li><p>endpoint-defaults.json</p>
  <p>{</p>
  <pre><code>   &quot;AppSettings&quot;: {
  
       //Default MasterCard properties
       &quot;mastercard.mip.signOnType&quot;: &quot;ONDEMAND&quot;,
       &quot;mastercard.mip.responseTimeout&quot;: 30,    
   }
  </code></pre>
  <p>}</p>
  </li>
  <li><p>jsconfig1.js</p>
  <p>{</p>
  <p>&quot;AppSettings&quot;: {</p>
  <pre><code> &quot;mastercard.mip.hostname&quot;: &quot;localhost&quot;,
   &quot;mastercard.mip.authorisation_port&quot;: 19092,
   &quot;mastercard.mip.test_authorisation_port&quot;: 19094,
  </code></pre>
  <p>}</p>
  <p>}</p>
  </li>
  </ol>