I have array in my appsettings.json
"steps": [
{
"name": "IMPORT",
"enabled": true
},
{
"name": "IMPORT_XML",
"enabled": true
},
{
"name": "COMPARE",
"enabled": true
},
{
"test_name": "COMPARE_TABLE",
"enabled": true
}]
In my class I am trying to retrieve it using IConfigurationRoot _configurationRoot
I've tried:
var procSteps = _configurationRoot.GetSection("steps");
foreach (IConfigurationSection section in procSteps.GetChildren())
{
var key = section.GetValue<string>("test");
var value = section.GetValue<string>("enabled");
}
and:
var procSteps = _configurationRoot.GetSection("ExecutionSteps")
.GetChildren()
.Select(x => x.Value)
.ToArray();
But none of them retrieved me values of it. Does anyone know what's the case and what is the correct way to access values of such array?