read_json

Contents

read_json#

read_json(json_file: str | CloudPath | Path, print_file: bool = True) dict[source]#

Read a JSON file

Parameters:
  • json_file (AnyPathStrType) – Path to JSON file

  • print_file (bool) – Print the configuration file

Returns:

JSON data

Return type:

dict

Example

>>> json_path = 'D:/path/to/json.json'
>>> read_json(json_path, print_file=False)
{"A": 1, "B": 2}