Module Utils.JSON

Module to manipulate JSON file.

val parse_file : string -> Ezjsonm.value option

parse_file file_path opens the file and parses it as a JSON value. If there is an error during the process, it returns None. If it succeeds, it returns Some JSON.

val parse_metrics_config : unit -> Ezjsonm.value option

parse_metrics_config is just a shortcut for parse_file metrics_config_path.

val extract_from_array : Ezjsonm.value -> Ezjsonm.value list

extract_from_array json extracts the list from json where json is an Ezjsonm.value.`A. Otherwise, it returns the empty list.

val extract_from_obj : Ezjsonm.value -> (string * Ezjsonm.value) list

extract_from_obj json extracts the associative list from json where json is an Ezjsonm.value.`O. Otherwise, it returns the empty list.

val extract_from_string : Ezjsonm.value -> string

extract_string converts a Ezjsonm.value.`String into an OCaml string.

val export_to : path:string -> Ezjsonm.value -> unit

export_to ~path json writes json into the file referenced by path.