How to find the size of a json object? #2557
Replies: 3 comments 4 replies
-
|
Beta Was this translation helpful? Give feedback.
-
I have a similar question, due to trying to track down the cause of a stack overflow --- I specifically want the size of the json object (along with all its sub objects, etc.) in memory. |
Beta Was this translation helpful? Give feedback.
-
I need to use http bulk API that limits the size of json text representation I can send. So I would like to have an efficient way of doing something like json bulk;
size_t upperBound = 0;
for (const auto& event : json_events)
{
upperBound += event.upper_bound_size();
if (upperBound < threshold)
bulk.push_back(event);
else
break;
}
send(bulk); |
Beta Was this translation helpful? Give feedback.
-
I am trying to limit the size of the JSON object to 16KB. Is it possible to check the size of the JSON object and cap it to 16KB?
Beta Was this translation helpful? Give feedback.
All reactions