json2str()

json2str()#

json2str converts a JSON object into a formatted string with indentation.

Prototype

char *json2str(
    const json_t *jn
);

Parameters

Key

Type

Description

jn

const json_t *

The JSON object to be converted into a string.


Return Value

A newly allocated string containing the formatted JSON representation. The caller must free the returned string using gbmem_free().

Notes

The function uses JSON_INDENT(4) for formatting and JSON_REAL_PRECISION(get_real_precision()) to control floating-point precision.

Prototype

// Not applicable in JS

Prototype

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