code: def _generate_tables(self, files):
      for i, file in enumerate(files):
          if self.config.field is not None:
              with open(file, encoding="utf-8") as f:
                  dataset = json.load(f)
  
              # We keep only the field we are interested in
              dataset = dataset[self.config.field]
  
              # We accept two format: a list of dicts or a dict of lists
              if isinstance(dataset, (list, tuple)):
                  pa_table = paj.read_json(
                      BytesIO(
                          "\n".join(
                              json.dumps(row) for row in dataset
                          ).encode("utf-8")
                      ),
                      read_options=self.config.pa_read_options,
                      parse_options=self.config.pa_parse_options,
                  )
              else:
                  pa_table = pa.Table.from_pydict(mapping=dataset)
          else:
              try:
                  pa_table = paj.read_json(
                      file,
                      read_options=self.config.pa_read_options,
                      parse_options=self.config.pa_parse_options,
                  )
              except pa.ArrowInvalid:
                  with open(file, encoding="utf-8") as f:
                      dataset = json.load(f)
                  raise ValueError(
                      f"Not able to read records in the JSON file at {file}. "
                      f"You should probably indicate the field of the JSON file containing your records. "
                      f"This JSON file contain the following fields: {str(list(dataset.keys()))}. "
                      f"Select the correct one and provide it as `field='XXX'` to the dataset loading method. "
                  )
          if self.config.features:
              # Encode column if ClassLabel
              for i, col in enumerate(self.config.features.keys()):
                  if isinstance(
                      self.config.features[col], datasets.ClassLabel
                  ):
                      pa_table = pa_table.set_column(
                          i,
                          self.config.schema.field(col),
                          [
                              self.config.features[col].str2int(
                                  pa_table[col]
                              )
                          ],
                      )
              # Cast allows str <-> int/float, while parse_option explicit_schema does NOT
              # Before casting, rearrange JSON field names to match passed features schema field names order
              pa_table = pa.Table.from_arrays(
                  [pa_table[name] for name in self.config.features],
                  schema=self.config.schema,
              )
          yield i, pa_table
  
file_path: DeepKE/example/ner/cross/uie_json.py
imports: import json
  from dataclasses import dataclass
  from io import BytesIO
  from typing import Optional
  import pyarrow
  import pyarrow.json
  import datasets
label_desc: Use image node_id 3 for calling the Json obj's underlying member method code with example usage: obj._generate_tables(files) without return types