I have a list like following in config.json file `
{
\"foo\": {
\"bar\": [
\"1\",
\"2\",
\"3\"
]
}
}`
I am ab
Just to add on Ahamed Ishak answer. Convert actual objects to JSON would clean up the code and types are respected. Avoid string typo errors, etc.
var appSettings = JsonConvert.SerializeObject(new
{
Security = new SecurityOptions {Salt = "test"}
});
var builder = new ConfigurationBuilder();
builder.AddJsonStream(new MemoryStream(Encoding.UTF8.GetBytes(appSettings)));
var configuration = builder.Build();