json2gbuf()
#
The function json2gbuf()
serializes a JSON object into a gbuffer_t
structure, appending the JSON data to the buffer.
Prototype
gbuffer_t *json2gbuf(
gbuffer_t *gbuf,
json_t *jn,
size_t flags
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
A pointer to an existing |
|
|
A JSON object to be serialized. The function takes ownership of this parameter. |
|
|
Flags controlling the JSON serialization behavior. |
Return Value
Returns a pointer to a gbuffer_t
containing the serialized JSON data. If an error occurs, NULL is returned.
Notes
The function uses json_dump_callback()
to serialize the JSON object into the buffer. If gbuf
is NULL, a new buffer is allocated with a default size.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples