code: def to_json(idata, filename):
      """Save dataset as a json file.
  
      Will use the faster `ujson` (https://github.com/ultrajson/ultrajson) if it is available.
  
      WARNING: Only idempotent in case `idata` is InferenceData.
  
      Parameters
      ----------
      idata : InferenceData
          Object to be saved
      filename : str
          name or path of the file to load trace
  
      Returns
      -------
      str
          filename saved to
      """
      file_name = idata.to_json(filename)
      return file_name
  
label_desc: Use image node_id 2 for calling a global function with example usage: to_json(idata, filename) and returns: file_name