【发布时间】:2017-11-01 12:46:01
【问题描述】:
如何使用Microsoft.Extensions.Configuration 获取appsettings.json 数据?我的 JSON 在下面,但这段代码不起作用。一般来说,我的愿望是得到一个数组或列表。但我做不到。
var someArray = configuration.GetSection("Test").GetChildren().Select(x => x).ToArray();
"Test": [
{
"A": "101",
"B": "6390"
},
{
"A": "101",
"B": "6391"
},
{
"A": "101",
"B": "6392"
}
]
【问题讨论】:
标签: c# .net json asp.net-core