Let's say I have a config.json
like this:
{
"CustomSection": {
"A": 1,
"B": 2
}
}
I know I can use an IConfiguration
object to get specific settings, i.e., configuration.Get("CustomSection:A")
, but can I grab the whole hierarchy (in any type - even a raw string would be fine)? When I try configuration.Get("CustomSection")
, I get a null
result, so I think this isn't supported by default.
My use case is grabbing entire configuration dictionaries at once without having to grab each individual setting - some properties may not be known at compile time.
Edit: updating this answer for the 1.0 release of Core.
This is possible now if you use a strongly typed object, for example: