title: How to replace list items in a custom appsettings.json file?
body: <p>I have custom appsettings.json files for each environment, so appsettings.Dev.json, appsettings.Test.json, appsettings.Prod.json. In the main appsettings.json, I have the following code:</p>
  
  <pre><code>  "EmailSettings": {
      "Recipients": [
        "person@test.com"
      ]
    }
  </code></pre>
  
  <p>Then in the custom json file, I want to override this list, like this:</p>
  
  <pre><code>  "EmailSettings": {
      "Recipients": [
        "anotherperson@test.com"
      ]
    }
  </code></pre>
  
  <p>But instead, this gets appended like this:</p>
  
  <pre><code>  "EmailSettings": {
      "Recipients": [
        "person@test.com",
        "anotherperson@test.com"
      ]
    }
  </code></pre>
  
  <p>With all other types of settings, they get replaced, but for some reason, it seems that lists in custom settings files get appended instead. With .net, you used to have more granularity with the xslt to be able to determine whether you wanted to replace or append overridden settings. Any suggestions here?</p>
  
  <h2>SOLUTION (for me)</h2>
  
  <p>I did this, and it gets replaced in the custom json settings. Main appsettings.json:</p>
  
  <pre><code>  "EmailSettings": {
      "Recipients:0": "person@test.com"
    }
  </code></pre>
  
  <p>Then in the custom settings file:</p>
  
  <pre><code>  "EmailSettings": {
      "Recipients:0": "anotherperson@test.com"
    }
  </code></pre>
  
  <p>Thanks for the responses!</p>