core.jsonio =========== .. py:module:: core.jsonio .. autoapi-nested-parse:: Generic JSON I/O utilities. Exceptions ---------- .. autoapisummary:: core.jsonio.JsonDecodeError core.jsonio.JsonIOError Functions --------- .. autoapisummary:: core.jsonio.load core.jsonio.save Module Contents --------------- .. py:exception:: JsonDecodeError Bases: :py:obj:`JsonIOError` Exception raised when JSON decoding fails. .. py:exception:: JsonIOError Bases: :py:obj:`Exception` Base exception for JSON I/O operations. .. py:function:: load(path: pathlib.Path | str) -> dict Load JSON data from a file. Args: path: Path to the JSON file. Returns: Parsed JSON data as a dictionary. Raises: FileNotFoundError: If the file does not exist. JsonDecodeError: If the file contains invalid JSON. .. py:function:: save(path: pathlib.Path | str, data: dict, *, indent: int = 2, sort_keys: bool = True, ensure_ascii: bool = False) Save dictionary data to a JSON file. Args: path: Path where the JSON file will be saved. data: Dictionary data to save. indent: Number of spaces for indentation (default: 2). sort_keys: Whether to sort dictionary keys (default: True). ensure_ascii: Whether to escape non-ASCII characters (default: False). Note: Parent directories will be created automatically if they don't exist.