首页 > 解决方案 > JsonCpp:如何将对象转换/序列化为 Json::Value

问题描述

是否可以Json::Value在 jsonCpp 中转换/序列化对象?

例如:我有课

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;

我想改变myObjectto Json::Value,也许像

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

标签: c++jsoncpp

解决方案


推荐阅读