kw_duplicate()

kw_duplicate()#

kw_duplicate() creates a deep copy of a JSON object or array, processing serialized fields to ensure proper duplication.

Prototype

json_t *kw_duplicate(
    hgobj gobj,
    json_t *kw  // NOT owned
);

Parameters

Key

Type

Description

gobj

hgobj

Handle to the gobj (generic object) for logging and error handling.

kw

json_t *

The JSON object or array to duplicate. Must not be NULL.


Return Value

A new JSON object or array that is a deep copy of kw, with serialized fields properly handled. Returns NULL if kw is not an object or array.

Notes

Unlike json_deep_copy(), kw_duplicate() processes serialized fields to ensure correct duplication of binary data.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples