code: def read_from_labelstudio_json(path, data_columns, label_columns):
      """
      read data from exported .json files and return an Dataframe
      (include the JSON and JSON-MIN files from Label-Studio)
  
      params:
      - path: str: the path of the exported file
      - data_columns: list[str]: the key/column names of the data
      - label_columns: list[str]: the key/column names of the label
      """
      if not os.path.exists(path):
          raise OSError("annotation file path not exists.")
  
      with open(path, mode="r") as fp:
          label_studio_json = json.load(fp)
          if len(label_studio_json) == 0:
              raise ValueError("ERROR: empty export file")
  
          if "annotations" in label_studio_json[0]:
              # the file is export through JSON
              # JSON file parsing is available to specify nested data
              annotation = pd.json_normalize(
                  data=label_studio_json,
                  record_path=["annotations", "result"],
                  meta=["data"],
              )
              data = pd.DataFrame(annotation["data"].values.tolist())
  
              # annotation: labeling content
              # data: data content/url/...
              df = pd.DataFrame()
  
              columns = data.columns
              for col in data_columns:
                  if col in columns:
                      df[col] = data[col]
                  else:
                      print(
                          "skip '{}' for not in the export data columns".format(
                              col
                          )
                      )
  
              columns = annotation.columns
              for col in label_columns:
                  if col in columns:
                      df[col] = annotation[col]
                  else:
                      print(
                          "skip '{}' for not in the export label columns".format(
                              col
                          )
                      )
  
              return df
  
          else:
              # the file is export through JSON-MIN
  
              df = pd.DataFrame()
              annotation_table = pd.json_normalize(
                  data=label_studio_json
              )
  
              for col in data_columns:
                  if col in annotation_table:
                      df[col] = annotation_table[col]
                  else:
                      print(
                          "skip '{}' for not in the export data columns".format(
                              col
                          )
                      )
  
              for col in label_columns:
                  if col in annotation_table:
                      df[col] = annotation_table[col]
                  else:
                      print(
                          "skip '{}' for not in the export label columns".format(
                              col
                          )
                      )
  
              return df
  
file_path: autogluon/multimodal/src/autogluon/multimodal/utils/label_studio.py
imports: import json
  import os
  from enum import Enum
  import pandas
label_desc: Use image node_id 2 for calling a global function with example usage: read_from_labelstudio_json(path, data_columns, label_columns) and returns: df, df