(
    filepath: types.PathLike,
    *,
    mode: str = "rt",
    encoding: Optional[str] = None,
    lines: bool = False,
)
Read the contents of a JSON file at ``filepath``, either all at once
    or streaming item-by-item.

    Args:
        filepath: Path to file on disk from which data will be read.
        mode: Mode with which ``filepath`` is opened.
        encoding: Name of the encoding used to decode or encode the data
            in ``filepath``. Only applicable in text mode.
        lines: If False, all data is read in at once; otherwise, data is read in
            one line at a time.

    Yields:
        Next JSON item; could be a dict, list, int, float, str,
        depending on the data and the value of ``lines``.
Read the contents of a JSON file at ``filepath``, either all at once
    or streaming item-by-item.
Read the contents of a JSON file at filepath either all at once or streaming item - by - item .
def read_json(
    filepath: types.PathLike,
    *,
    mode: str = "rt",
    encoding: Optional[str] = None,
    lines: bool = False,
) -> Iterable:
    """
    Read the contents of a JSON file at ``filepath``, either all at once
    or streaming item-by-item.

    Args:
        filepath: Path to file on disk from which data will be read.
        mode: Mode with which ``filepath`` is opened.
        encoding: Name of the encoding used to decode or encode the data
            in ``filepath``. Only applicable in text mode.
        lines: If False, all data is read in at once; otherwise, data is read in
            one line at a time.

    Yields:
        Next JSON item; could be a dict, list, int, float, str,
        depending on the data and the value of ``lines``.
    """
    io_utils._validate_read_mode(mode)
    with io_utils.open_sesame(filepath, mode=mode, encoding=encoding) as f:
        if lines is False:
            yield json.load(f)
        else:
            for line in f:
                yield json.loads(line)
def read_json ( filepath : types . PathLike , * , mode : str = "rt" , encoding : Optional [ str ] = None , lines : bool = False , ) -> Iterable : io_utils . _validate_read_mode ( mode ) with io_utils . open_sesame ( filepath , mode = mode , encoding = encoding ) as f : if lines is False : yield json . load ( f ) else : for line in f : yield json . loads ( line )