JsonCpp: how to convert/serialize an object to Json::Value

Viewed 348

Is it possible to convert/serialize an object to Json::Value in jsonCpp?

For example: I have class

class MyClass
{
   std::string str1;
   std::string str2;
   std::unordered_map<std::string, std::string> map1;
   std::unordered_map<std::string, std::string> map2;
   bool boo1;

   void func1();
   void func2();
}

MyClass myObject;

and I would like to change the myObject to Json::Value, something maybe like

Json::Value myJson = JsonParse(myObject) //not a real code
0 Answers
Related