We know that we can parse json file into IConfigurationRoot as
public class Startup
{
public IConfigurationRoot Configuration { get; }
public Startup(IHostingEnvironment env)
{
this.Configuration = new ConfigurationBuilder()
.SetBasePath(path)
.AddJsonFile("somefile.json")
.Build();
}
}
But I want to use ConfigurationBuilder to parse a json string so can access just like how it works with json file so that I can do:
string jsonString = XXX(); // external calls to get json
var config = new ConfigurationBuilder().AddJsonString(jsonString).Build();
string name = config["Student:Name"];
So does imaginal AddJsonString exists or is any third party library I need to use to achieve this?
P.S
I can't use JsonSerializer because the json payload has too many property therefore I can't create a POJO model class to be deserialized with, if there are only 3 or 4 property, then I can certainly do that, but 50 properties (that has nested properties) is a different story
