如何在ConfigurationBuilder中使用JSON对象本身而不是文件路径?
我是在k8s群集中存储为configmap的JSON文件。因此,我没有C#中ConfigurationBuilder类所需的路径。有没有一种方法可以从JSON对象本身而不是FilePath构建配置?
I am gettin the json file stored as ConfigMap in K8s cluster. So I do not have the path as required in ConfigurationBuilder class in C#. Is there a way to build configuration from JSON object itself rather than the filepath ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您能够从源获取JSON字符串,则可以调用 configurationBuild.add 方法通过将其传递给
以下是示例代码。
您也可以致电 addjsonstream 构建器上的方法通过将流传递给它。.
我希望这将有助于解决您的问题。
If you are able to get the JSON string from the source, you can call ConfigurationBuild.Add method by passing it an object of JsonStreamConfigurationSource class.
Following is the sample code.
You can also call AddJsonStream method on builder by passing the stream to it..
I hope this will help resolve you issue.