neuralib.io.json
- class neuralib.io.json.JsonEncodeHandler[source]
Extend from the JSONEncoder class and handle the conversions in a default method
Usage: Add kwarg, e.g.,
json_dump(..., cls=JsonEncodeHandler)
- neuralib.io.json.load_json(filepath, **kwargs)[source]
Load a json as dict :param filepath: json filepath :param kwargs: additional arguments to
json.load():return:- Parameters:
filepath (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader)
- Return type:
dict[str, Any]
- neuralib.io.json.save_json(filepath, dict_obj, **kwargs)[source]
Save dict as a json file
- Parameters:
filepath (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – json filepath
dict_obj (dict[str, Any]) – dictionary object
kwargs – additional arguments to
json.dump()
- Return type:
None