json_config()
#
The json_config
function merges multiple JSON configuration sources into a single JSON string, allowing for variable substitution and expansion. It processes fixed, variable, file-based, and parameter-based configurations in a structured order.
Prototype
char *json_config(
BOOL print_verbose_config,
BOOL print_final_config,
const char *fixed_config,
const char *variable_config,
const char *config_json_file,
const char *parameter_config,
pe_flag_t quit
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
If |
|
|
If |
|
|
A fixed JSON configuration string that cannot be modified. |
|
|
A JSON configuration string that can be modified. |
|
|
A file path containing JSON configuration data. |
|
|
A JSON string containing additional configuration parameters. |
|
|
Determines the behavior on error, such as exiting or continuing execution. |
Return Value
Returns a dynamically allocated JSON string containing the merged configuration. The caller must free the returned string using jsonp_free()
.
Notes
[‘The function processes configurations in the following order: fixed_config
, variable_config
, config_json_file
, and parameter_config
.’, ‘If print_verbose_config
or print_final_config
is TRUE
, the function prints the configuration and exits.’, ‘The function supports variable substitution using the __json_config_variables__
key.’, ‘The JSON string can contain one-line comments using ##^
.’, ‘If an error occurs in JSON parsing, the function may exit based on the quit
parameter.’]
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples