code: 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)
  
file_path: textacy/src/textacy/io/json.py
imports: from __future__ import annotations
  import datetime
  import functools
  import json
  from typing import Any, Iterable, Optional, Union
  from ..None import types
  from .None import utils
label_desc: Use image node_id 1 for calling a global function with example usage: read_json(filepath) without return types