I have looked for answers on stackoverflow and none of them helped me so I am putting this question again. I have a config file config.json which looks like this :
{
"key1" : "value1",
"key2" : ["a", "b", "c"]
}
And I am trying this to read the config file :
#include <fstream>
#include <json/json.h>
std::ifstream config_file("config.json", std::ifstream::binary);
Json::Value config;
config_file >> config;
cout<<config;
cout<<config["key1"];
Running this gives me the following error:
Error from reader: * Line 1, Column 1
Syntax error: value, object or array expected.
libc++abi.dylib: terminating with uncaught exception of type Json::RuntimeError: * Line 1, Column 1
Syntax error: value, object or array expected.
Abort trap: 6
I can't seem to figure out what the issue is. Thank you for your time.