Microsoft.Extensions.Configuration has its own API for navigating through the JSON contained in the config file it reads in. (This is what ASP.NET uses for configuration)
For a given JSON node- is there a way to get access to its contents as a string rather than as more Configuration objects? I have JSON objects in my config file which I need to run through a JSON deserializer (so I just want to read this node from the file as a string).
Something akin to the following:
var myObjectsSection = configuration.GetSection("MyObjects");
var innerText = myObjectsSection.InnerText; //Is there any way to do this???
var myObjs = JsonConvert.DeserializeObject<MyObject[]>(innerText);
Config file:
{
"SomeSetting": "mySetting",
"MyObjects": [
{
...
},
{
...
}
]
}