input_json: Input values into json file

View source: R/input_json.R

input_jsonR Documentation

Input values into json file

Description

Inputs values into json file by locating the label and key within the json file. Preserves comments (!) if present. NOTE: this does not use a json parser so if there are json formatting errors this function will not pick them up.

Usage

input_json(file, label, key, value, out_file = NULL)

Arguments

file

filepath; to json file which you wish to edit

label

string; which corresponds to section where the key is located

key

string; name of key in which to input the value

value

string; to be input into the key/value pair. Note boolean values must be input as 'true'/'false' as per the json format

out_file

filepath; to write the output json file (optional); defaults to overwriting file if not specified

Author(s)

Tadhg Moore, Jorrit Mesman

Examples


## Not run: 
input_json(file = "samp.par", label = "ModelParameters", key = "f_wind", value = 1.2, out_file = NULL)

## End(Not run)

aemon-j/LakeEnsemblR documentation built on April 11, 2025, 10:09 p.m.