save_json

Contents

save_json#

save_json(json_dict: dict, output_json: str | CloudPath | Path, **kwargs) None[source]#

Changed in version 1.32.0: The order of the function has changed. Please set json_dict in first!

Save a JSON file, with datetime, numpy types and Enum management.

Parameters:
  • json_dict (dict) – Json dictionary

  • output_json (AnyPathStrType) – Output file

  • **kwargs – Other arguments

Example

>>> output_json = 'D:/path/to/json.json'
>>> json_dict = {"A": np.int64(1), "B": datetime.today(), "C": SomeEnum.some_name}
>>> save_json(output_json, json_dict)