jsonablize
ΒΆ
JSONablize (qurry.capsule.jsonablize
)
- qurry.capsule.jsonablize.key_parse(k: Any) str | int | float | bool | None [source]ΒΆ
Make key json-allowable. If a value is not allowed by json, them return its β__str__β.
str, int, float, bool or None
- Parameters:
o (any) β Key.
- Returns:
Json-allowable key.
- Return type:
any
- qurry.capsule.jsonablize.parse(o: Any) Any [source]ΒΆ
Make a python object json-allowable.
- Parameters:
o (any) β Python object.
- Returns:
Json-allowable python object.
- Return type:
any
- qurry.capsule.jsonablize.quickJSON(content: Iterable, filename: str | Path, mode: str, indent: int = 2, encoding: str = 'utf-8', jsonable: bool = False, save_location: Path | str = PosixPath('.'), mute: bool = True) str | None [source]ΒΆ
Configurable quick JSON export.
- Parameters:
content (any) β Content wants to be written.
filename (str) β Filename of the file.
indent (int, optional) β Indent length for json. Defaults to 2.
encoding (str, optional) β Encoding method. Defaults to βutf-8β.
jsonablize (bool, optional) β Whether to transpile all object to jsonable via
mori.jsonablize()
. Defaults to False.save_location (Union[Path, str], optional) β Location of files. Defaults to Path(β./β).
mute (bool, optional) β Mute the exportation. Defaults to True.
- Returns:
The filename of the file when not mute.
- Return type:
Optional[str]