save_as_json¶

save_as_json(data, save_path, *, parents=False, exist_ok=False)[source]¶

Save data to a json file.

The function will deepcopy the data and then jsonify the content in place. Support data types for jsonify consist of str, int, float, bool and their np.ndarray respectively.

Parameters:
  • data (dict or list) – Input data to save.

  • save_path (PathLike) – Output to save the json of input.

  • parents (bool) – Make parent directories if they do not exist. Default is False.

  • exist_ok (bool) – Overwrite the output file if it exists. Default is False.

Return type:

None