c# - 为 appsettings.json 中的属性添加值并将其转换为 json
问题描述
在 appsettings.json 的 ASP.NET Core Web 应用程序中,我有:
"SVAML" : {
'instructions':[
{
'name' : 'PlayFiles',
'ids' : ['inside controller put string value here']
}
],
'action': {
'name' : 'Continue'
}
}
在我的控制器内部,我可以使用 _configuration["SVAML"] 访问它的值,我需要将值放入控制器中并在放入此值后将其作为 json 发送,例如 JObject.Parse(_configuration["SVAML"])。 toString() 作为请求的主体。
解决方案
为 SVAML 创建一个类并对其进行序列化。
推荐阅读
- c# - C# - 格式化柱形图
- javascript - 条件关闭标签 ReactJS
- python - 许多 nltk 包方法/工具都不起作用
- sql-server - to_sql 未更新 ms 服务器中的表
- julia - 嵌套在 for 循环中的 if 块的 Julia 变量的范围
- c# - 将datagridview的列保存在List中
- python - 将从远程存储库获取的 python 包传递给 spark 提交/shell
- bash - .gz 文件日志中 txt 列表中的大 grep
- angularjs - 意外请求:GET 后跟 [$rootScope:inprog] $digest 已经在进行中。Angularjs 和 Karma
- r - 识别、分组数据框 (R) 中的唯一条目