kw_collapse()
#
kw_collapse()
returns a new JSON object where arrays or dictionaries exceeding specified size limits are collapsed into a placeholder structure indicating their path and size.
Prototype
json_t *kw_collapse(
hgobj gobj,
json_t *kw, // not owned
int collapse_lists_limit,
int collapse_dicts_limit
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
A handle to the calling object, used for logging and error reporting. |
|
|
The JSON object to be processed. Must be a dictionary. |
|
|
The maximum allowed size for lists before they are collapsed. |
|
|
The maximum allowed size for dictionaries before they are collapsed. |
Return Value
A new JSON object with large lists and dictionaries collapsed. Returns NULL
if kw
is not a dictionary.
Notes
Collapsed elements are replaced with a structure containing __collapsed__
metadata, including their path and size.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples