简体   繁体   English

为 appsettings.json 中的属性添加值并将其转换为 json

[英]Adding value to property in appsettings.json and convert it to json

In ASP.NET Core web application in appsettings.json I have:在 appsettings.json 中的 ASP.NET Core Web 应用程序中,我有:

"SVAML" : {
        'instructions':[
         {
            'name' : 'PlayFiles',
            'ids' : ['inside controller put string value here']
         }
        ],

        'action': {
            'name' : 'Continue'
        }
}

Inside my controller I can access the value of it with _configuration["SVAML"], what I need is put the value inside controller and send it as json after putting this value, like JObject.Parse(_configuration["SVAML"]).toString() as body of request.在我的控制器中,我可以使用 _configuration["SVAML"] 访问它的值,我需要的是将值放入控制器并在放入此值后将其作为 json 发送,例如 JObject.Parse(_configuration["SVAML"])。 toString() 作为请求的主体。

为 SVAML 创建一个类并将其序列化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM