We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
以“六年级-三班-某学生”为例,学生由结构体转换为json字符,作为班级的成员; 班级由结构体转换为json字符,作为年级的成员; 由年级json字符无法解析出classParm成员变量,解析出的结构只有"{"
#include "mainwindow.h" #include <QApplication> #include <iostream> #include "../iguana/iguana/json.hpp" // 六年级-三班-某学生 struct Person { std::string name; int age; }; REFLECTION(Person, name, age); struct Class { int classID; std::string personParm; }; REFLECTION(Class, classID, personParm) struct Grade { int gradeID; std::string classParm; }; REFLECTION(Grade, gradeID, classParm) int main(int argc, char *argv[]) { QApplication a(argc, argv); // MainWindow w; // w.show(); Person p; p.age = 10; p.name = "suli"; iguana::string_stream pp; iguana::json::to_json(pp, p); std::cout << pp.str() << std::endl; Person res_p; iguana::json::from_json(res_p, pp.str().c_str()); Class c; c.classID = 3; c.personParm = pp.str(); iguana::string_stream cc; iguana::json::to_json(cc, c); std::cout << cc.str() << std::endl; //const char* dd= "{\"classID\":3,\"personParm\":\"{\\\"name\\\":\\\"suli\\\",\\\"age\\\":10}\"}"; Class res_c; iguana::json::from_json(res_c, cc.str().c_str()); Grade g; g.gradeID = 6; g.classParm = cc.str(); iguana::string_stream gg; iguana::json::to_json(gg, g); std::cout << gg.str().c_str() << std::endl; Grade res_g; iguana::json::from_json(res_g, gg.str().c_str()); Grade res; iguana::json::from_json(res, gg.str().c_str()); return a.exec(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
以“六年级-三班-某学生”为例,学生由结构体转换为json字符,作为班级的成员; 班级由结构体转换为json字符,作为年级的成员; 由年级json字符无法解析出classParm成员变量,解析出的结构只有"{"
The text was updated successfully, but these errors were encountered: