json¶
JSON I/O module.
Classes
Safe JSON reader. |
|
Safe JSON writer. |
- class JSONReader[source]¶
Bases:
object
Safe JSON reader.
- class JSONWriter[source]¶
Bases:
object
Safe JSON writer.
- static check(path, overwrite=False)[source]¶
Checks that a file has of the correct extension and verifies that we can overwrite it if it exists.
- Parameters:
path (
Union
[str
,Path
]) – Path to the file.overwrite (bool)
- Returns:
- static write(data, path, overwrite=False, verbose=True)[source]¶
Writes serializable data into a JSON file.
- Parameters:
data (
Union
[List
,Dict
]) – Serializable data.path (
Union
[str
,Path
]) – Path to the file.overwrite (
bool
) – Whether to overwrite, in case of an existing file.verbose (
Union
[bool
,int
]) – Verbosity of the method.
- Returns: