Appsettings.json JSON file transformation

Hi there,

In the past we’ve always used the app.config / app.Release.config config file transformations, with the variable substitutions defined in the app.Release.config files and the replacements defined per environment. This has worked incredibly well in Octopus!

We’re now having to switch to some appsettings.json files and I’m not sure how to mimic the behaviour that we’ve relied on before. I understand that variable substitutions work in JSON files, but can Octopus transform these appsettings.json files as well? I.e. could we define an appsettings.json and an appsettings.Release.json and in the appsettings.Release.config file use the same variables as we’ve used the app.Release.config files in the past and have Octopus replace them per environment?

Any advice you can provide would be much appreciated!

Cheers,
Annie

Hi Annie,

Thanks for getting in touch! Unfortunately there is no way for Octopus to perform this kind of transformation. However, I can provide you with some hopefully helpful information on working around this.

The following blog post was provided to me by a developer and it discusses a configuration method where you can load your appsettings.json and override configuration values instead of transforming.

Hopefully the above blog post will give you some ideas on how you can model this into your project.

If you have any questions here please don’t hesitate to let me know.

Best regards,
Daniel

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.