We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to initialise a json object from file. using json = nlohmann::json; std::ifstream file("Config.json"); json object(file);
using json = nlohmann::json;
std::ifstream file("Config.json");
json object(file);
I get the following error on terminal
terminate called after throwing an instance of 'std::invalid_argument' what(): parse error - unexpected '�'; expected string literal
And following warning on output
Main.cpp:31:21: warning: ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::basic_json(std::istream&, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::parser_callback_t) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string; BooleanType = bool; NumberIntegerType = long long int; NumberUnsignedType = long long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; std::istream = std::basic_istream; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::parser_callback_t = std::function<bool(int, nlohmann::basic_json<>::parse_event_t, nlohmann::basic_json<>&)>]’ is deprecated (declared at libs/json.hpp:1945) [-Wdeprecated-declarations] json object(file);
I'm using g++ (Ubuntu 4.9.4-2ubuntu1~12.04) 4.9.4 for compiling. C++11 is enabled.
Am I doing something wrong?
The text was updated successfully, but these errors were encountered:
The quotation marks in Config.json were wrong kind. Works now.
Sorry, something went wrong.
Hey I am facing the same issue, could you please tell me what you did to fix it?
@kariya2 How does your JSON file look like? What exception do you get while parsing it?
No branches or pull requests
I'm trying to initialise a json object from file.
using json = nlohmann::json;
std::ifstream file("Config.json");
json object(file);
I get the following error on terminal
And following warning on output
I'm using g++ (Ubuntu 4.9.4-2ubuntu1~12.04) 4.9.4 for compiling.
C++11 is enabled.
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: