I am trying to put some mapping config represented in json:
[{"Name":"xyz","Ids":["456f782d468","c65b4703"]},{"Name":"abc","Ids":["a95fg567","456sdf564"]}]
Is it possible to store a json in appsettings?
I know I can create a custom section in web.config.
But this app may be deployed to Azure Web Apps where appsettings is the only way I see this config can go.
Not nicely. The web.config is XML and quotes are not allowed in XML without escaping them to ". Doing that on a JSON still will make it "difficult" to read / maintain. Base64 that serhiyb is one solution, but that will not be maintainable by a person either.
I'd store them as appsettings key/value pairs and then generate the json string at runtime.
If you are 100% the string will never change, then escaping or Base64 is an option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With