Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nested object from local.settings.json in Azure function v3 settings

I have an Azure function v3 in .NET core 3.1 Function works fine locally. Here is the local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true"
  },
  "Foo": {
    "Bar": {
      "test1": true,
      "test2": false
    }
  }
}

I need to write a configuration for a nested object like Foo:Bar:test1 in Azure function configuration.

How to express this nested object there?

like image 538
Michael Chudinov Avatar asked Mar 10 '26 13:03

Michael Chudinov


1 Answers

The correct syntax for configuration options for Azure functions to express nested objects is to use double underscore: "CustomSettings__MySpecificSetting".

For a nested object in local.settings.json file:

"Foo": {
   "Bar": {
     "test1": true
    }
}

The Azure configuration looks like:

Foo__Bar__test1
like image 60
Michael Chudinov Avatar answered Mar 13 '26 17:03

Michael Chudinov