Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dear 当我在apollo配置中心添加了一个json文件,IConfigurationRoot 无法获取json中的全部数据 #237

Open
xiaoqiang2018 opened this issue Aug 8, 2023 · 3 comments

Comments

@xiaoqiang2018
Copy link

No description provided.

@xiaoqiang2018 xiaoqiang2018 changed the title dear 当我在apollo配置中心添加了一个json dear 当我在apollo配置中心添加了一个json文件,IConfigurationRoot 无法获取json中的全部数据 Aug 8, 2023
@xiaoqiang2018
Copy link
Author

xiaoqiang2018 commented Aug 8, 2023

  IConfigurationRoot root = new ConfigurationBuilder().AddApollo(apolloOptions)
            .AddNamespace("jsonfile", Com.Ctrip.Framework.Apollo.Enums.ConfigFileFormat.Json)
            .Build();
            //这种方式无法获取全部的json数据。why?
                        string content = root["content"];

@xiaoqiang2018
Copy link
Author

我看到 有通过 ApolloConfigurationManager 获取数据,但是已经被废弃了

@pengweiqhca
Copy link
Contributor

pengweiqhca commented Aug 9, 2023

json不能获取原始内容,会转换成key/value,参考appsetting.json。
如果想获取json原始数据,就使用普通的properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants