using json = nlohmann::json;
string str = R"({"happy": true,"pi": 3.141})";
// if I replace it with "json js = json::parse(str.c_str());", it works!
json js = str;
// this returns ""[json.exception.type_error.305] cannot use operator[] with a string argument with string"
auto v1 = js["happy"].get<bool>();
What is the issue you have?
I get an exception when I do an implicit conversion and then read a value.
I read here that
json = stringshould work.Please describe the steps to reproduce the issue. Can you provide a small but working code example?
Which compiler and operating system are you using? Is it a supported compiler?
VS2017
Did you use a released version of the library or the version from the
developbranch?develop, tried also the latest release and happens also
Maybe I am doing something wrong? I am evaluating this project to replace
cjsonand I hope that I will make the switch. 👍Thank you