You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have class A which includes a std::deque<class B>.
Both A and B have an AsJson() that return a json object, where A's AsJson pushes back many instances of B onto an array, and later on I print this Json as a string.
nlohmann::json json;
// add some other fields
...
...
for (auto e : events) {
json["events"].push_back(e->AsJson());
}
return json;
// later outputting json to stream as string or cbor
Constructing the large Json takes a bit of memory and time and then the whole things needs to be processed again to format to a string as well.
Is there a better way to handling constructing and outputting Jsons with large arrays with this library?
Thanks!
The text was updated successfully, but these errors were encountered:
Hey everyone,
I have
class A
which includes astd::deque<class B>
.Both
A
andB
have anAsJson()
that return a json object, whereA
'sAsJson
pushes back many instances ofB
onto an array, and later on I print this Json as a string.Constructing the large Json takes a bit of memory and time and then the whole things needs to be processed again to format to a string as well.
Is there a better way to handling constructing and outputting Jsons with large arrays with this library?
Thanks!
The text was updated successfully, but these errors were encountered: