-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Description
I have a class and inside that class i have a struct, now i want to write the class variable "name" and the structure member "a" in the json file but i am not able to do so, can you please help me with the problem. :-
Code snipet ->
class ABC
{
public:
struct ex
{
public:
int a;
};
static void registerclass()
{
ClassMetaInfo<ABC>::registerMember("name", &ABC::name);
ClassMetaInfo<ex>::registerMember("int a ", &ex::a);
}
std::string name;
ex var = { };
};
ABC::registerclass();
ABC p;
p.name = "JOHN";
json j = ClassMetaInfo<ABC>::deserialize(p);json file output :-
{
"name": "JOHN"
}By the above code i am getting the class variable "name" written in the json file but cannot see the structure variable "a" in the json file.
I have tried to put the registerclass() method inside the structure also but still i am not getting the stucture variable "a" written in my json file
(I want to write both the class variable and the structure variable in the json file, as per the above example i am expecting something like :-
{
"name": "JOHN"
" int a" : 32
}to be the json output
)
Can you please help me regarding the issue
(Compiling on a windows machine in visual studio 2017)