Helper function to convert export list to JSON
export_to_json(export_list, format, file = NULL, pretty = TRUE)The list to convert to JSON. Must contain variables, parameters, and arcs components, see details.
Character string specifying the export format. Currently, only
"json" is supported.
Optional character string specifying a file path to save the JSON
output. If NULL (default), the JSON string is returned.
Logical, whether to format the JSON output with indentation for
readability. Default is TRUE. Set to FALSE for more compact output.
The export_list must be a named list with the following components:
scenario_id: Optional identifier for the model run/scenario.
label: Optional name/label for the scenario.
variables: An array where each element represents a variable/node with its metadata, distribution type, and states (for categorical variables).
parameters: An array where each element represents a parameter with its link function, source variable, and coefficients.
arcs: An array with arc details, each containing source_variable_id and target_variable_id.