ASP.NET Core Get Json Array using IConfiguration

using System.Linq;
For an array of objects like 
"Clients": [ {..}, {..} ], 
you should invoke 
Configuration.GetSection("Clients").GetChildren()
using System.Linq;
For an array of literals like 
"Clients": [ "", "", "" ], 
you should invoke 
.GetSection("Clients").GetChildren().ToArray().Select(c => c.Value).ToArray()

Leave a Reply

Your email address will not be published. Required fields are marked *