not use jsoncpp api but throw "in Json::Value::resolveReference(key, end): requires objectValue " error
Describe the bug A clear and concise description of what the bug is. hello!I used the jsoncpp 1.7.4 library to execute the following code, but this code does not contain any operations related to JSON. After conducting a detailed log analysis, it was found that when the "CreateAI" function failed to execute and execute void* ptr=AIF->create(jsonStr);, this error occurred. Because of myGraph* create(std::string jsonStr), and from the log it seems that std::cout<<"json: "<<jsonStr<<std::endl was not printed. Then the error was reported as "in Json::Value::resolveReference(key, end): requires objectValue"
void* CreateAI(void* factory, const char* jsonStr) { AIFactory* AIF=static_cast<AIFactory*>(factory); if(AIF) { std::cout<<"Conversion successful "<<AIF<<std::endl; } else std::cout<<"Conversion failed"<<std::endl; void* ptr=AIF->create(jsonStr); return ptr; } myGraph* create(std::string jsonStr) { try { std::cout<<"json:"<<jsonStr<<std::endl; if(stringToTxt(jsonStr,"./CreateAI_log.txt")) std::cout<<"CreateAI json is saved"<<std::endl; else std::cout<<"CreateAI json save ERROR"<<std::endl; auto ai=new myGraph(jsonStr); AIs.push_back(ai); return ai;/* */ } catch(const std::exception& e) { std::cerr <<"myGraph: "<< e.what() << '\n'; }
}
To Reproduce Steps to reproduce the behavior: 1.
Expected behavior A clear and concise description of what you expected to happen.
Desktop (please complete the following information): jsoncpp 1.7.4 3.1ubuntu2
NAME="Ubuntu" VERSION="20.04.5 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.5 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 46 bits physical, 57 bits virtual CPU(s): 144 On-line CPU(s) list: 0-143 Thread(s) per core: 2 Core(s) per socket: 36 Socket(s): 2 NUMA node(s): 4 Vendor ID: GenuineIntel CPU family: 6 Model: 106 Model name: Intel(R) Xeon(R) Platinum 8352V CPU @ 2.10GHz Additional context Add any other context about the problem here.