有没有办法将我的自定义对象转换为json?
class EntityRepetitive: public EntityTreatment
{
public:
EntityRepetitive(int channelNum,float power,float freq,int numOfPulses,float waitTime, int numOfTrains);
~EntityRepetitive();
int channelNum;
float power;
float freq;
int numOfPulses;
float waitTime;
int numOfTrains;
};
我的cpp文件:
er = new EntityRepetitive(channelNum,power,freq,numOfPulses,waitTime,numOfTrains);
我想将er转换为JsonString,反之亦然。