code: def read_json(file, output_type="Figure", skip_invalid=False):
      """
      Construct a figure from the JSON contents of a local file or readable
      Python object
  
      Parameters
      ----------
      file: str or readable
         A string containing the path to a local file or a read-able Python
         object (e.g. an open file descriptor)
  
      output_type: type or str (default 'Figure')
          The output figure type or type name.
          One of:  graph_objs.Figure, 'Figure', graph_objs.FigureWidget, 'FigureWidget'
  
      skip_invalid: bool (default False)
          False if invalid figure properties should result in an exception.
          True if invalid figure properties should be silently ignored.
  
      Returns
      -------
      Figure or FigureWidget
      """
  
      # Check if file is a string
      # -------------------------
      # If it's a string we assume it's a local file path. If it's not a string
      # then we assume it's a read-able Python object
      file_is_str = isinstance(file, string_types)
  
      # Read file contents into JSON string
      # -----------------------------------
      if file_is_str:
          with open(file, "r") as f:
              json_str = f.read()
      else:
          json_str = file.read()
  
      # Construct and return figure
      # ---------------------------
      return from_json(
          json_str, skip_invalid=skip_invalid, output_type=output_type
      )
  
imports: from __future__ import absolute_import
  from six import string_types
  import json
  from plotly.io._utils import validate_coerce_fig_to_dict, validate_coerce_output_type
label_desc: Use image node_id 4 for calling a global function with example usage: read_json(file, output_type, skip_invalid) and returns: from_json