Trying to serialize a class I have into a json string. Of course I can just write the strings manually, but I was hoping to utilize a the picojson library.
What I am trying to achieve is, given this class A
class A {
public:
int field1;
string field2;
}
A a;
a.field1 = 1;
a.field2 = "example";
I want to convert this class instance "a" into a picojson object and then call picojson::serialize() to get the json string.
{"field1": 1, "field2": "example"}