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

please provide an API to read JSON from file directly. #1725

Closed
coolsnake opened this issue Aug 26, 2019 · 3 comments
Closed

please provide an API to read JSON from file directly. #1725

coolsnake opened this issue Aug 26, 2019 · 3 comments
Labels
kind: enhancement/improvement solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope)

Comments

@coolsnake
Copy link

  • Describe the feature in as much detail as possible.
    In most case, I have a config file with json format data in it. I want to load this config parameter directly.

  • Include sample usage where appropriate.
    For example, I have a mysql client that will read the configuration of MySQL ip address, port, user name and password. All these infos are provided in a json file.

@nlohmann
Copy link
Owner

This can be easily done with the public API:

json from_file(const std::string& filename)
{
    std::ifstream s(filename);
    return json::parse(s);
}

@nlohmann
Copy link
Owner

(That said, I do not think that such a function needs to be added to the library.)

@nlohmann nlohmann added the solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope) label Aug 27, 2019
@coolsnake
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement/improvement solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope)
Projects
None yet
Development

No branches or pull requests

2 participants