I am trying to write some complex structures into json file. In that course, I have a struct as below -
struct State {
std::vector<float> array1;
std::vector<structA> array2;
Tensor tensor1;
}
For the vectors in the struct, I am able to write the values into json objects like below.
State stateObj;
frameJson["arrays"] = {{"array1", stateObj.array1},
{"array2", stateObj.array2}}
I use to_json()for custom data types.
With the Tensor, the class only provides a pointer to the data with a getPointer() method and I have the tensor size and shape information. With this pointer how do I create a json object, which has the below format. I just want to store the floating point values from the tensor object.
{"tensor", [Tensor data array]}