#include <iostream> #include <json json.h=""> using namespace std; #define ACTIVE "active" class Test { public: void testFun(Json::Value& payload) { if(payload.isMember(ACTIVE)) { bool val = payload[ACTIVE].asBool(); } else { std::cout<<"Not found"<<std::endl; } } } int main() { test obj; json::value payload; payload["timestamp"]="12345" ; payload["keytimestamp"]="23456" payload["active"]="true; payload["data"]="payload" payload["command"]="put" obj.testfun(payload); }
c++ exception with description "in json::value::find(key,end,found: requires objectvalue or nullvalue" thrown in body.
#include <iostream> #include <json json.h=""> using namespace std; #define ACTIVE "active" class Test { public: void testFun(Json::Value& payload) { if(payload.isMember(ACTIVE)) { bool val = payload[ACTIVE].asBool(); } else { std::cout<<"Not found"<
class Test
test
Test
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)