While trying parsing a json string in my c++ code, using the library minijson, I got a code like that so far:
<<"version">> [&]() { result.setVersion(v.as_long()); }
<<"capabilities">> [&]()
{
parse_array(ctx, [&](value capability)
{
result.getCapabilities().push_back(capability.as_string());
});
}
the data should be stored on this struct
:
struct block_template {
int version;
vector<string> capabilities;
...
}
the version
value is stored correctly, but the vector is staying with size 0. I try visualize the data being read from the json string ( with cout << capability.as_string() << endl
) and it's display correctly, just not being stored in the data structure.
Anyone who already worked with this library can give a hint of what's wrong here?